This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2020-08-20. 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.

Article version: Enterprise Server 2.18

Adding a remote

To add a new remote, use the git remote add command on the terminal, in the directory your repository is stored at.

In this article

The git remote add command takes two arguments:

  • A remote name, for example, origin
  • A remote URL, for example, https://[hostname]/user/repo.git

For example:

$ git remote add origin https://hostname/user/repo.git
# Set a new remote

$ git remote -v
# Verify new remote
> origin  https://hostname/user/repo.git (fetch)
> origin  https://hostname/user/repo.git (push)

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:

$ git remote add origin https://hostname/octocat/Spoon-Knife
> fatal: remote origin already exists.

To fix this, you can

Further reading

Ask a human

Can't find what you're looking for?

Contact us