Renaming a Remote

suggest change

Rename a remote with git remote rename.

The git remote rename command takes two arguments:

Get existing remote name

git remote
# origin

Check existing remote with URL

git remote -v 
# origin https://github.com/username/repo.git (fetch)
# origin https://github.com/username/repo.git (push)

Rename remote

git remote rename origin destination
# Change remote name from 'origin' to 'destination'

Verify new name

git remote -v 
# destination https://github.com/username/repo.git (fetch)
# destination https://github.com/username/repo.git (push)

Possible errors

  1. Could not rename config section ‘remote.[old name]’ to ‘remote.[new name]’

The old remote name (origin in the example) does not exist.

  1. Remote [new name] already exists.
Error message is self explanatory.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents