Change the URI for a Remote Git Repository

If you need to edit the URL for a remote Git repository then you could use the following command.

git remote set-url origin git://

See git help remote or you can just edit .git/config and change the URLs there. Open .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)

See also: GitHub: Changing a remote’s URL

Other related posts:
Git Delete a Local or Remote Branch
How to Clone a Git Repository into a Specific Folder?
How to Merge a Local Git Branch with Master
How to Setup Aliases and Shortcuts for Git Commands
How to create a .gitignore file in Windows

This content has been helpful to you?

Thanks for contributing!

Yes No