我用如下方法克隆个人存储库: 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