我使用以下内容克隆存储库:

git clone ssh://xxxxx/xx.git 

但在我更改一些文件并添加和提交它们之后,我想将它们推送到服务器:

git add xxx.php
git commit -m "TEST"
git push origin master

但我得到的错误是:

error: src refspec master does not match any.  
error: failed to push some refs to 'ssh://xxxxx.com/project.git'

当前回答

万一您在执行gitinit并推送初始提交后仍面临此问题。然后,您可以尝试以下操作:,

git checkout -b "new branch name"
git push origin "new branch name"

您的代码将作为新分支推送。

其他回答

git push-u原始主机

error: src refspec master does not match any.
error: failed to push some refs to 'http://REPO.git'

这是由于存储库仍然是空的。存储库中没有提交,因此没有主分支可以推送到服务器。

这对我有用

决议

1) git init
2)git commit -m "first commit"
3)git add app
4)git commit -m "first commit"
5)git push -u origin master

我犯了这个错误,

错误:src-refspec-master与任何不匹配。

当我试图将提交推送到GitHub时,发生了变化(在GitHub)。

git push -u origin branch-name - helped me to get my local files up to date

来自Git的错误:

错误:src-refspec-master与任何不匹配。

已修复此步骤:

git commit -m "first commit"

在我跑步之前:

git add <files>

在我跑步后:

git push -u origin master

此问题的另一个可能原因是您拼写错误了分支名称。因此,如果你做了我所做的,那么问题将通过纠正来解决:

git push origin mater

to

git push origin master

对我来说,我必须确保公钥在服务器(附加在~/.ssh/authorized_keys中)和GitHub/Bitbucket(添加到GitHub或Bitbucket上的ssh密钥中)中正确配置-它们需要匹配。然后:

git add --all :/
git commit -am 'message'
git push -u origin master