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

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 push origin HEAD

其他回答

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

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

最近遇到了这个问题,我所做的是使用检查show ref,git显示参考并检查

参考/主管/主管

出席。

它是存在的,但它仍然对我不起作用。

在我写作的时候

 git push origin main

后来我用git推送原始主机

这对我来说非常好。

我也犯了类似的错误。但Git告诉我:

*** Please tell me who you are.

Run

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

或设置帐户的默认身份。

Omit --global to set the identity only in this repository.

然后错误消失。

我也有同样的问题。我通过以下步骤做到了这一点:

1. git commit -m 'message'
2. git config --global user.email "your mail"
3. git config --global user.name "name"
4. git commit -m 'message'
5. git push -u origin master

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