我用如下方法克隆個人存儲庫: php
git clone ssh://xxxxx/xx.git
可是,在我更改了一些文件並add
並commit
它們以後,我想將它們推送到服務器: git
git add xxx.php git commit -m "TEST" git push origin master
可是我獲得的錯誤是: github
error: src refspec master does not match any. error: failed to push some refs to 'ssh://xxxxx.com/project.git'
當您在特定分支中並嘗試推入尚不存在的另外一個分支時,也會發生這種狀況,例如: 服務器
$ git branch * version-x # you are in this branch version-y $ git push -u origin master error: src refspec master does not match any. error: failed to push some refs to 'origin_address'
若是是第一次使用它,則須要配置Git安裝,它具備: ssh
git config --global user.email "you@example.com" git config --global user.name "Your Name"
缺乏或跳過git add .
或git commit
可能致使此錯誤: ide
git push -u origin master Username for 'https://github.com': yourusername Password for 'https://yourusername@github.com': error: src refspec master does not match any. error: failed to push some refs to 'https://github.com/yourusername/foobar.git'
要修復此問題,請從新初始化並遵循正確的順序: this
git init git add . git commit -m 'message' git *create remote git push -u origin master
因此我嘗試了Vi的解決方案 : spa
git push origin HEAD:<remoteBranch>
這對我有用。 code
若是您要推送的分支名稱中有錯字,也會發生這種狀況。 rem