使用 Git 将远程 'origin' 更改为 'upstream'
Change remote 'origin' to 'upstream' with Git
我已经从原始来源的 upstream
master
仓库中克隆了一个 Git 仓库到我的本地机器上。
git remote -v
returns:
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
.
的新遥控器
我已经从原始来源的 upstream
master
仓库中克隆了一个 Git 仓库到我的本地机器上。
git remote -v
returns:
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
.