2016-09-13 31 views
0

不同的行爲在Windows上我平時的工作流程是:Git:錯誤src refspec不匹配任何;在Windows和Linux

git init 
git pull https://<repo_address> "branch_name" 
git commit --all -m"message" 
git push https://<repo_address> "branch_name" 

執行所有分支的測試後,合併掌握,讓我們說

git checkout master 

或只是cd到另一個目錄和合並

git pull https://<repo_address> "branch_name" 

在Windows上,它完美的工作。然而,當我移植我的應用程序到Linux,令人驚訝的我就死在推着我的分支

git init 
git pull https://<repo_address> "branch_name" 
git commit --all -m"message" 
git push https://<repo_address> "branch_name" 

獲得知名錯誤

error: src refspec branch_name does not match any. 
error: failed to push some refs to 'https://<repo_address>' 

我發現一對夫婦的解決方案,但沒有適合我。不知道原因是操作系統,也許只是不同的版本或其他。

在Linux Git版本2.1.4

回答

1

我建議做任何一個克隆(其拉下回購和所有分支機構),或者如果你想獲得只是一個單一的分支,你可以添加遠程然後取出分支。克隆可能是最簡單的,但如果您只想要單個分支,則可以執行以下步驟。

git init 
git remote add -t <branch_name> -f origin https://<repo_address> 
git checkout <branch_name> 

然後你可以提交和推送。

相關問題