Update Git Repo Origin Url

January 23, 2016

You may be using GitHub, BitBucket, Visual Studio Team Services, GitLab or one of a few dozen other source control providers for Git Repositories. You may come across a time in your Git days when a Repository's URL changes, whether it's because the server domain name changed, the protocol (http -> https), or other reasons. In this case, you can update the Origin URL for your existing cloned repos locally by executing the following commands.

You can see the current origin URL by invoking the following command within a Git bash shell within the cloned repo folder

git remote -v

To update the origin simply invoke the following within that same Git bash shell and within the cloned repo folder

git remote set-url origin https://this.is.where.your.paste.your.new.url

Share

Comments