1
0
mirror of synced 2025-12-21 10:57:10 -05:00
Files
docs/content/github/using-git/adding-a-remote.md
Jason Etcovitch caaee7a124 Update all files to use {% data %} (#15253)
* Add back changes from prior to purge

* Manually fix some invalid Liquid

* Updoot render-content

* Improve test messages to show correct output

* Run el scripto

* Pass the remaining test
2020-09-29 16:01:04 -04:00

1.6 KiB

title, intro, redirect_from, versions
title intro redirect_from versions
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.
/articles/adding-a-remote
free-pro-team enterprise-server
* *

The git remote add command takes two arguments:

  • A remote name, for example, origin
  • A remote URL, for example, https://{% data variables.command_line.backticks %}/user/repo.git

For example:

$ git remote add origin https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git
# Set a new remote

$ git remote -v
# Verify new remote
> origin  https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.git (fetch)
> origin  https://{% data variables.command_line.codeblock %}/<em>user</em>/<em>repo</em>.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://{% data variables.command_line.codeblock %}/octocat/Spoon-Knife
> fatal: remote origin already exists.

To fix this, you can

Further reading