使用Git将远程“原点”更改为“上游”

我已经将一个 Git 仓库从原始源的upstream master仓库克隆到了我的本地机器上。

git remote -v返回:

origin  https://github.com/project.git (fetch)
origin  https://github.com/project.git  (push)

但我现在知道我需要将这个upstream master分支分叉到我的个人 GitHub 帐户,克隆它,创建一个新分支,然后开始编码(这样我就不会直接对upstreamrepo进行更改,而是对我自己的分叉originrepo进行更改)。我已将 分叉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.


以上是使用Git将远程“原点”更改为“上游”的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>