Article version: Enterprise Server 2.15

This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2019-10-16. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Renaming a remote

Use the git remote rename command to rename an existing remote.

The git remote rename command takes two arguments:

Example

These examples assume you're cloning using HTTPS, which is recommended.

$ git remote -v
# View existing remotes
> origin  https://hostname/OWNER/REPOSITORY.git (fetch)
> origin  https://hostname/OWNER/REPOSITORY.git (push)

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

$ git remote -v
# Verify remote's new name
> destination  https://hostname/OWNER/REPOSITORY.git (fetch)
> destination  https://hostname/OWNER/REPOSITORY.git (push)

Troubleshooting

You may encounter these errors when trying to rename a remote.

Could not rename config section 'remote.[old name]' to 'remote.[new name]'

This error means that the remote you tried the old remote name you typed doesn't exist.

You can check which remotes currently exist with the git remote -v command:

$ git remote -v
# View existing remotes
> origin  https://hostname/OWNER/REPOSITORY.git (fetch)
> origin  https://hostname/OWNER/REPOSITORY.git (push)

Remote [new name] already exists.

This error means that the remote name you want to use already exists. To solve this, either use a different remote name, or rename the original remote.

Further reading

Ask a human

Can't find what you're looking for?

Contact us