阅读(4287) (0)

GitHub 为复刻配置远程仓库

2020-08-19 14:49:04 更新

必须在 Git 中配置指向上游仓库的远程仓库,才能将您在复刻中所做的更改同步 到原始仓库。 这也允许您将在原始仓库中所做的更改同步到复刻中。

  1. 打开 Git Bash。

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

   $ git remote -v
   > origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (fetch)
   > origin  https://github.com/YOUR_USERNAME/YOUR_FORK.git (push)

  1. 指定将与复刻同步的新远程上游仓库。

$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

  1. 验证为复刻指定的新上游仓库。

   $ 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)