How to change the URI for a remote Git repository?
Asked by Sumit Talwar · · 2896 views
I have migrated the remote repository to another host, So, I need to change the remote’s URL.
So, please guide how to change the URL of a Git remote?
# View existing remotes git remote -v # origin https://github.com/user/repo.git (fetch) # origin https://github.com/user/repo.git (push) # Change the 'origin' remote's URL git remote set-url origin https://github.com/user/repo2.git # Verify new remote URL git remote -v # origin https://github.com/user/repo2.git (fetch) # origin https://github.com/user/repo2.git (push)
git remote set-url origin git://new.location
.git/config, look for [
remote "origin"], and edit the
url = line.
You can check it worked by examining the remotes:
git remote -v # origin git://new.location (fetch) # origin git://new.location (push)
Please login or create new account to participate in this conversation.