设置git push / pull时遇到困难

时间:2015-09-25 19:47:26

标签: git

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> EXP-20-DOMAIN-CONVERSION

这是什么意思?听起来我有一个远程分支,但它没有正确连接到远程存储库。 这曾经在不同的分支上工作。

我在尝试设置时遇到错误。

>git branch --set-upstream-to=origin/EXP-20-DOMAIN-CONVERSI
ON EXP-20-DOMAIN-CONVERSION
error: the requested upstream branch 'origin/EXP-20-DOMAIN-CONVERSION' 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 fetch,但它没有告诉我发生了什么。 我可以在网络浏览器中在线查看分支。

>git branch --v
* EXP-20-DOMAIN-CONVERSION              d53eae9 EXP-20-DOMAIN-CONVERSIOn started
 testing hash code
 ...other branches

我注意到上游错了。有一个undercase n。也许这是造成它的?我该如何解决?

1 个答案:

答案 0 :(得分:2)

正如您所猜测的,这是一个区分大小写的问题。对于区分大小写的文件系统,Git区分大小写。

要将远程分支重命名为正确(通过跟踪,删除和重新推送它),请运行以下命令:

$ git branch EXP-20-DOMAIN-CONVERSION origin/EXP-20-DOMAIN-CONVERSIOn
$ git push origin --set-upstream EXP-20-DOMAIN-CONVERSION
$ git push origin :EXP-20-DOMAIN-CONVERSIOn

或者如果您已经在正确的名称下拥有最新的本地分支,只需删除远程分支并重新推送:

$ git push origin --set-upstream EXP-20-DOMAIN-CONVERSION
$ git push origin :EXP-20-DOMAIN-CONVERSIOn