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)

No comments: