stut.io

How to rename an existing Git remote?

To change the name of an existing remote you will need to use the git remote rename command.

In order to change the name of your remote you will need two things:
1. The current name of your remote.
2. The name you want to change your remote to.

Let’s say that your current remote name is "origin". And now you want to change the remote name to "old".

1. Confirm the name of your current remote by running this command:

git remote -v

You should see an output like this. In this example, the remote name for the repo is "origin".

origin git@git.stut.io:projects/website.git (fetch)
origin git@git.stut.io:projects/website.git (push)

2. Now that the current remote name is confirmed — you can change it by running this command:

git remote rename origin old

This command tells git to rename the current remote to something different. In this example, we are changing the remote name to "old", but you can change your remote to be anything you want.

3. Verify that your remote has changed from "origin" to "old" by running this command:

git remote -v

You should see an output like this. In this example, the new remote name for the repo is "old".

old git@git.stut.io:projects/website.git (fetch)
old git@git.stut.io:projects/website.git (push)