Skip to main content

为分支配置远程存储库

Platform navigation

  1. 打开终端终端Git Bash

  2. 列出当前为复刻配置的远程仓库。

    $ git remote -v
    > origin  https://.com/YOUR-USERNAME/YOUR-FORK.git (fetch)
    > origin  https://.com/YOUR-USERNAME/YOUR-FORK.git (push)
    
  3. 指定将与分支同步的新远程上游存储库。

    git remote add upstream https://.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git
    
  4. 验证为复刻指定的新上游仓库。

    $ git remote -v
    > origin    https://.com/YOUR-USERNAME/YOUR-FORK.git (fetch)
    > origin    https://.com/YOUR-USERNAME/YOUR-FORK.git (push)
    > upstream  https://.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (fetch)
    > upstream  https://.com/ORIGINAL-OWNER/ORIGINAL-REPOSITORY.git (push)