git:錯(cuò)誤:src refspec master與任何不匹配

參見英文答案 > src refspec master does not match any when pushing commits in git 54個(gè)
將git存儲(chǔ)庫克隆到目錄“hggit”并設(shè)置遠(yuǎn)程源

mbm:hggit my name$git remote add origin git@code.getpantheon.com:"mystringhere"

編輯文件后,我提交了更改(位于子目錄中)

mbm:handelgroup michaelmausler$git commit -m "first commit"
[master 5a29bc8] first commit
 1 files changed, 2 insertions(+), 2 deletions(-)

然后我嘗試推送文件更改并收到以下錯(cuò)誤

mbm:hggit myname$git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'git@code.getpantheon.com:"mystringhere"'

如果git status確實(shí)表明你確實(shí)有一個(gè)活動(dòng)的主分支(因?yàn)槟愦_實(shí)做了第一次提交),檢查你在定義你的遠(yuǎn)程時(shí)是否有任何拼寫錯(cuò)誤:見“Push origin master error on new repository”:

git remote rm origin

Then I recreated the origin, making sure the name of my origin was typed EXACTLY the same way my origin was spelled.

git remote add origin git@....

你可以簡化:

git remote set-url origin git@....

然后,您可以在本地分支和遠(yuǎn)程跟蹤分支之間建立跟蹤鏈接:

git push -u origin master

您還可以將其推送到原點(diǎn)上的其他分支:

git push -u origin master:anotherBranch
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容