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

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'

当前回答

如果您尝试推送的分支名称中有拼写错误,也会发生这种情况。

其他回答

这对我有用,将存储库重置为远程主存储库:

git checkout master
git commit -a -m "your comment"
git push origin master

您可能忘记了命令gitadd。在gitinit命令之后。

我的分支名为bugfix-22112022/5v8ST5Q6/181 kontaktformular eingabe nach anmeldung-übernehmen,<--是的,它有一个逗号,我认为逗号不是它的一部分,并在尝试推送时删除了它。。。

我重命名了我的分支:

git branch -m bugfix-22112022/5v8ST5Q6/181-kontaktformular-eingabe-nach-anmeldung-übernehmen

我遇到了同样的问题,并使用以下步骤解决了它:

git pull--重新基数https://github.com/yours主人git添加。gitcommit-m'提交消息'git推送原始主机

试试看:

git add .

git commit -m "your commit message"

git remote add origin *remote repository URL*

git push origin *your-branch-name*