Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ To add a new remote, use the `git remote add` command on the terminal, in the di

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`
* A remote URL, for example, `https://{% data variables.command_line.backticks %}/OWNER/REPOSITORY.git`

For example:

```shell
$ git remote add origin https://{% data variables.command_line.codeblock %}/USER/REPO.git
$ git remote add origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git
# Set a new remote

$ git remote -v
# Verify new remote
> origin https://{% data variables.command_line.codeblock %}/USER/REPO.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/USER/REPO.git (push)
> origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git (push)
```

For more information on which URL to use, see "[AUTOTITLE](/get-started/getting-started-with-git/about-remote-repositories)."
Expand Down Expand Up @@ -77,11 +77,11 @@ The `git remote set-url` command takes two arguments:
* A new URL for the remote. For example:
* If you're updating to use HTTPS, your URL might look like:
```shell
https://{% data variables.command_line.backticks %}/USERNAME/REPOSITORY.git
https://{% data variables.command_line.backticks %}/OWNER/REPOSITORY.git
```
* If you're updating to use SSH, your URL might look like:
```shell
git@{% data variables.command_line.codeblock %}:USERNAME/REPOSITORY.git
git@{% data variables.command_line.codeblock %}:OWNER/REPOSITORY.git
```

### Switching remote URLs from SSH to HTTPS
Expand All @@ -91,19 +91,19 @@ git@{% data variables.command_line.codeblock %}:USERNAME/REPOSITORY.git
3. List your existing remotes in order to get the name of the remote you want to change.
```shell
$ git remote -v
> origin git@{% data variables.command_line.codeblock %}:USERNAME/REPOSITORY.git (fetch)
> origin git@{% data variables.command_line.codeblock %}:USERNAME/REPOSITORY.git (push)
> origin git@{% data variables.command_line.codeblock %}:OWNER/REPOSITORY.git (fetch)
> origin git@{% data variables.command_line.codeblock %}:OWNER/REPOSITORY.git (push)
```
4. Change your remote's URL from SSH to HTTPS with the `git remote set-url` command.
```shell
$ git remote set-url origin https://{% data variables.command_line.codeblock %}/USERNAME/REPOSITORY.git
$ git remote set-url origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git
```
5. Verify that the remote URL has changed.
```shell
$ git remote -v
# Verify new remote URL
> origin https://{% data variables.command_line.codeblock %}/USERNAME/REPOSITORY.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/USERNAME/REPOSITORY.git (push)
> origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git (push)
```

The next time you `git fetch`, `git pull`, or `git push` to the remote repository, you'll be asked for your GitHub username and password. {% data reusables.user-settings.password-authentication-deprecation %}
Expand All @@ -117,19 +117,19 @@ You can [use a credential helper](/get-started/getting-started-with-git/caching-
3. List your existing remotes in order to get the name of the remote you want to change.
```shell
$ git remote -v
> origin https://{% data variables.command_line.codeblock %}/USERNAME/REPOSITORY.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/USERNAME/REPOSITORY.git (push)
> origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/OWNER/REPOSITORY.git (push)
```
4. Change your remote's URL from HTTPS to SSH with the `git remote set-url` command.
```shell
$ git remote set-url origin git@{% data variables.command_line.codeblock %}:USERNAME/REPOSITORY.git
$ git remote set-url origin git@{% data variables.command_line.codeblock %}:OWNER/REPOSITORY.git
```
5. Verify that the remote URL has changed.
```shell
$ git remote -v
# Verify new remote URL
> origin git@{% data variables.command_line.codeblock %}: USERNAME/REPOSITORY.git (fetch)
> origin git@{% data variables.command_line.codeblock %}: USERNAME/REPOSITORY.git (push)
> origin git@{% data variables.command_line.codeblock %}: OWNER/REPOSITORY.git (fetch)
> origin git@{% data variables.command_line.codeblock %}: OWNER/REPOSITORY.git (push)
```

### Troubleshooting: No such remote '[name]'
Expand Down