我一直在Linux上使用git,沒有任何問題。不過,我最近不得不在Windows上使用git,所以我安裝了命令行客戶端,因爲這是我工作最愉快的方式。爲什麼Windows上的git無法識別遠程分支
我的問題是,我試圖檢出我在Linux上使用git checkout mybranchname
創建的分支,但它沒有工作。我必須指定git checkout -b mybranchname --track origin/mybranchname
。
從那以後,每當我去推我得到告訴
fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use
git push origin HEAD:mybranchname
To push to the branch of the same name on the remote, use
git push origin mybranchname
To choose either option permanently, see push.default in 'git help config'.
有誰知道爲什麼會這樣或如何解決它?
我在Linux上使用git版本2.12.0.windows.1和2.11.0。在兩種情況下,我的起源都是SSH上的GitHub Enterprise。
你確定你已經拼寫正確的分支?我問,因爲你說檢查一個現有的分支「沒有工作」。問題是,它應該**。如果你從遠程獲取,'git branch -a'將分支列爲'origin/mybranchname',那麼'git checkout mybranchname'應該創建一個本地分支並自動跟蹤遠程分支。既然你所說的是「它沒有用」,很難猜測問題是什麼。 –
我已經複製並粘貼它,所以我確信我的一切都正確 - 除了我在那裏有一個看不見的控制字符太多了。請參閱下面的答案。 – mjaggard