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

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'

当前回答

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

其他回答

 sudo git push -v --progress "origin" : origin/prod_18aug2022

当我从本地分支机构推到远程分支机构时,这对我很有用。

也许GitHub不知道你是谁。

首先,您必须运行:

git config --global user.email "you@example.com"
git config --global user.name "Your Name"

只有提交解决了此错误:

git commit -m "first commit"

首先,gitadd。第二,gitcommit-m“message”第三,git推送原点分支

请检查拼写错误,因为这也可能导致错误。

git add .

这就是你所需要的。该代码跟踪目录中所有未跟踪的文件。