Jun 18, 2014

[git] how to change remote repository url

We have some development servers. We build source on the development on these servers. When I executed 'git fetch', git required another guy's password.

git fetch
#Password for 'https://another.guy@git.com':


Of course, I don't know his password. So I decided to change remote repository url. I got found the answer here.


git remote -v
#origin https://another.guy@git.com/scm/xxx.git (fetch)
#origin https://another.guy@git.com/scm/xxx.git (push)

git remote set-url origin https://git.com/scm/xxx.git

git remote -v
#origin https://git.com/scm/xxx.git (fetch)
#origin https://git.com/scm/xxx.git (push)

git fetch
#Username for 'https://git.com/': my.user
#Password for 'https://my.user@git.com':


---
git remote set-url origin https://git.com/scm/xxx.git
git remote -v
#origin https://git.com/scm/xxx.git (fetch)
#origin https://another.guy@git.com/scm/xxx.git (push)

git remote set-url --push origin https://git.com/scm/xxx.git
git remote -v
#origin https://git.com/scm/xxx.git (fetch)
#origin https://git.com/scm/xxx.git (push)

Jun 15, 2014

[git] how to remove remote tag

If you just started to use maven release plug in, you would get some problems with release plug in like failed on prepare due to not exist snapshot version, or failed on prepare because of existing tag. I would like to share how to remove git tag from remote.
It's easy. Just run the following commands. That's it!

git tag -d myapp-0.0.1
git push origin :refs/tags/myapp-0.0.1