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

参见英文答案 > src refspec master does not match any when pushing commits in git 54个
将git存储库克隆到目录“hggit”并设置远程源

mbm:hggit my name$git remote add origin git@code.getpantheon.com:"mystringhere"

编辑文件后,我提交了更改(位于子目录中)

mbm:handelgroup michaelmausler$git commit -m "first commit"
[master 5a29bc8] first commit
 1 files changed, 2 insertions(+), 2 deletions(-)

然后我尝试推送文件更改并收到以下错误

mbm:hggit myname$git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'git@code.getpantheon.com:"mystringhere"'

如果git status确实表明你确实有一个活动的主分支(因为你确实做了第一次提交),检查你在定义你的远程时是否有任何拼写错误:见“Push origin master error on new repository”:

git remote rm origin

Then I recreated the origin, making sure the name of my origin was typed EXACTLY the same way my origin was spelled.

git remote add origin git@....

你可以简化:

git remote set-url origin git@....

然后,您可以在本地分支和远程跟踪分支之间建立跟踪链接:

git push -u origin master

您还可以将其推送到原点上的其他分支:

git push -u origin master:anotherBranch
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容