我不知道我是否误用了Git,或者我是否有配置问题,所以任何清晰度都会受到赞赏:)
我将我的github repos克隆到机器A和B上,然后在机器AI上:
git checkout -b branchA
// make edits
git add .
git commit -am "initial"
git push
Run Code Online (Sandbox Code Playgroud)
然后在机器B上我做
git pull
git checkout branchA
// make edits
git commit -am "edits"
git push
Run Code Online (Sandbox Code Playgroud)
在机器A我然后做:
git pull
Run Code Online (Sandbox Code Playgroud)
但它说:
There is no tracking information for the current branch
Run Code Online (Sandbox Code Playgroud)
所以我必须这样做:
git branch --set-upstream branchA origin/branchA
Run Code Online (Sandbox Code Playgroud)
:/为什么我必须设置上游,当它最初将它推送到origin/branchA没有问题?
这是怎么回事?谢谢
我正在使用msygit 1.8.在窗户上
PS当我pull在机器B上执行时,为什么branchA默认情况下不跟踪新分支?git branch不显示它(但它确实-r).我可以默认跟踪所有新的远程分支pull?
Von*_*onC 13
因为git config push.default没有返回任何东西,这意味着,使用"git 1.8.0.msysgit.0",你的git push手段git push origin :,refspec ' :'代表"匹配"分支.
这里它branchA在远程端创建匹配.
但这并不能使它成为远程跟踪分支.
换句话说,branch.branchA.merge没有设置任何东西.
这就是git pull失败的原因:它不知道它应该合并到本地的远程分支branchA.
请注意,您的第一个git push应该显示以下消息:
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Run Code Online (Sandbox Code Playgroud)
所以,使用Git2.0,git push会失败.
推送的唯一方法branchA是明确设置其上游分支(使用相同的名称):
git push -u origin branchA
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6049 次 |
| 最近记录: |