- ターミナルターミナルGit Bashを開いてください。
- フォーク用に現在構成されたリモートリポジトリを一覧表示します。
$ git remote -v > origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch) > origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)
- フォークと同期する、新しいリモート上流リポジトリを指定します。
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
- フォーク用に指定した新しい上流リポジトリを検証します。
$ git remote -v > origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch) > origin https://github.com/YOUR_USERNAME/YOUR_FORK.git (push) > upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (fetch) > upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git (push)
フォークにリモートを設定する
You must configure a remote that points to the upstream repository in Git to sync changes you make in a fork with the original repository. これにより、オリジナルのリポジトリ内で行った変更をフォークと同期することもできるようになります。