问题描述
我已将原始源的 upstream
master
存储库中的 Git 存储库克隆到我的本地计算机。
git remote -v
返回:
origin https://github.com/project.git (fetch)
origin https://github.com/project.git (push)
但我现在知道我需要将这个 upstream
master
分支分叉到我的个人 GitHub 帐户,克隆它,创建一个新分支,然后开始编码(这样我就不会直接更改为 upstream
存储库,而是更改为我自己的分叉 origin
存储库)。我已将 upstream
master
分叉到我的 GitHub 个人资料,但不知道如何继续。我需要让 git remote -v
看起来像这样:
origin https://github.com/myGitHubProfile/project.git (fetch)
origin https://github.com/myGitHubProfile/project.git (push)
upstream https://github.com/project.git (fetch)
upstream https://github.com/project.git (push)
鉴于我已经从原始来源克隆了 upstream
master
并且它已经设置为 origin
,我该如何实现?
解决方法
您似乎正在寻找:
git remote rename origin upstream
git remote add origin https://github.com/myGitHubProfile/project.git
给“旧的”origin
遥控器一个新的 upstream
名称并添加名为 origin
的新遥控器。