Changing a remote’s URL in Git

Reading Time: < 1 minutes

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 (fetch)
origin (push)

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

$ git remote set-url origin

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


Was this post helpful?

Leave a Reply