Git 将现有存储库推送到新的和不同的远程存储库服务器?

问题描述:

假设我在 git.fedorahosted.org 上有一个存储库 并且我想将其克隆到我在 github 的帐户中,以便在 Fedorahosted 上拥有更多官方"存储库之外的自己的游乐场.最初复制它的步骤是什么?在 github 中有一个不错的fork"按钮,但由于显而易见的原因我不能使用它.

Say I have a repository on git.fedorahosted.org and I want to clone this into my account at github to have my own playground aside from the more "official" repo on fedorahosted. What would be the steps to initially copy that over? Within github there is this nice "fork" button, but I can't use this for obvious reasons.

我如何将 fedorahosted 存储库中的更改跟踪到 github 存储库中?

And how would I track changes in the fedorahosted repo into the github one?

  1. 在 github 创建一个新的存储库.
  2. 将存储库从 fedorahosted 克隆到本地计算机.
  3. git remote rename origin upstream
  4. git remote add origin URL_TO_GITHUB_REPO
  5. git push origin master

现在您可以像使用任何其他 github 存储库一样使用它.要从上游提取补丁,只需运行 git pull upstream master &&git push origin master.

Now you can work with it just like any other github repo. To pull in patches from upstream, simply run git pull upstream master && git push origin master.