git remote rename command to rename an existing remote.
The git remote rename command takes two arguments:
- An existing remote name, for example, origin
- A new name for the remote, for example, destination
These examples assume you’re cloning using HTTPS, which is recommended.
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:
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.