To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at.
git remote add command takes two arguments:
- A remote name, for example, origin
- A remote URL, for example,
Not sure which URL to use? Check out “Which remote URL should I use?”
Troubleshooting You may encounter these errors when trying to add a remote.
Remote name already exists This error means you’ve tried to add a remote with a name that already exists in your local repository:
To fix this, you can
- Use a different name for the new remote
- Rename the existing remote
- Delete the existing remote