1
0
mirror of synced 2025-12-23 21:07:12 -05:00
Files
docs/content/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork.md
2021-03-17 12:31:29 -07:00

32 lines
1.7 KiB
Markdown

---
title: Configuring a remote for a fork
intro: 'You must configure a remote that points to the upstream repository in Git to [sync changes you make in a fork](/articles/syncing-a-fork) with the original repository. This also allows you to sync changes made in the original repository with the fork.'
redirect_from:
- /articles/configuring-a-remote-for-a-fork
versions:
free-pro-team: '*'
enterprise-server: '*'
github-ae: '*'
topics:
- pull requests
---
{% data reusables.command_line.open_the_multi_os_terminal %}
2. List the current configured remote repository for your fork.
```shell
$ git remote -v
> origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_FORK</em>.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_FORK</em>.git (push)
```
3. Specify a new remote *upstream* repository that will be synced with the fork.
```shell
$ git remote add upstream https://{% data variables.command_line.codeblock %}/<em>ORIGINAL_OWNER</em>/<em>ORIGINAL_REPOSITORY</em>.git
```
4. Verify the new upstream repository you've specified for your fork.
```shell
$ git remote -v
> origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_FORK</em>.git (fetch)
> origin https://{% data variables.command_line.codeblock %}/<em>YOUR_USERNAME</em>/<em>YOUR_FORK</em>.git (push)
> upstream https://{% data variables.command_line.codeblock %}/<em>ORIGINAL_OWNER</em>/<em>ORIGINAL_REPOSITORY</em>.git (fetch)
> upstream https://{% data variables.command_line.codeblock %}/<em>ORIGINAL_OWNER</em>/<em>ORIGINAL_REPOSITORY</em>.git (push)
```