codecamp

GitHub 为复刻配置远程仓库

必须在 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)
GitHub 关于复刻
GitHub 同步复刻
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定