我有一个存储库尚未与我想要将其推送到的存储库关联。审核通过后,我们准备提交工作中征求意见。
首先,我添加了我想将其推送到的上游存储库:
git remote add upstream git@ssh.dev.azure.com:v3/place/projectgroup/repo
这是第一个也是唯一一个添加的上游,和之前一样它只存在于我的 Mac 上。然后我尝试添加上游:
$ git branch --set-upstream-to origin/candidate/1.0
error: the requested upstream branch 'origin/candidate/1.0' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
$ git push -u origin/candidate/1.0 HEAD
fatal: 'origin/candidate/1.0' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何使用尚不存在的上游名称将当前分支推送到远程存储库?
假设您在 Branch 上mybranch。然后你说
git push -u upstream mybranch
Run Code Online (Sandbox Code Playgroud)
这意味着:“将我的本地mybranch,将其推送到upstream远程(在那里它也将被调用mybranch),同时,给我一个跟踪分支,它将充当本地mybranch和远程之间的链接mybranch。”
如果您希望远程名称与本地名称不同,请使用冒号语法,例如mybranch:remotebranch。(你实际上可能不得不说mybranch:refs/heads/remotebranch,我对此有点困惑。)
| 归档时间: |
|
| 查看次数: |
3809 次 |
| 最近记录: |