Changing a remote’s URL in Git

Reading Time: < 1 minute

To change the remote URL for a repository, you’ll need to update the configuration file with the new URL. Otherwise, you’ll get an error when attempting to push your repository. If you don’t want to edit the configuration file, you can use the git remote set-url command changes an existing remote repository URL.

For example:

$ git remote -v
origin  https://github.com/USERNAME/REPOSITORY.git (fetch)
origin  https://github.com/USERNAME/REPOSITORY.git (push)

Change your remote’s URL via git remote set-url

$ git remote set-url origin https://github.com/USERNAME/REPOSITORY.git

To verify these changes, try $ git remote -v again.


Source: https://help.github.com/en/articles/changing-a-remotes-url

Was this post helpful?

Leave a Reply