Git – How to Rename a Git Remote

git

I currently have a git remote called heroku and I'd like to rename it to production.

$ git remote -v
heroku  https://git.heroku.com/example.git (fetch)
heroku  https://git.heroku.com/example.git (push)

Best Answer

$ git remote rename <old-name> <new-name>

So, for this example:

$ git remote rename heroku production

Useful docs here: https://docs.github.com/en/get-started/getting-started-with-git/managing-remote-repositories#renaming-a-remote-repository

Related Question