git:error:src refspec master不匹配任何 [英] git: error: src refspec master does not match any

查看:226
本文介绍了git:error:src refspec master不匹配任何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将git存储库克隆到目录hggit并将远程原点设置为

  mbm:hggit my name $ git remote添加源git@code.getpantheon.com:mystringhere

编辑完文件后,同时位于一个子目录中)与

$ $ p $ mbm:handelgroup michaelmausler $ git commit -m第一次提交
[master 5a29bc8]第一次提交
更改了1个文件,2次插入(+),2次删除( - )

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

  mbm:hggit myname $ git push origin master 
错误:src refspec master与任何不匹配。
错误:无法将某些参考文献推送到'git@code.getpantheon.com:'mystringhere''


git status 确实表明你有一个活动的主分支(因为你完成了所有的第一次提交),请检查您在定义远程时是否犯了打字错误:请参阅在新资料库中推送原始主错误: p>

  git remote rm origin 




然后我重新创建了原点,确保输入了原点的名称与我的原点拼写完全相同。




  git remote add origin git @ .... 

你可以简化为:

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

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

  git push -u原始大师

您也可以将它推送到原产地的不同分支:

  git push -u原点大师:anotherBranch 


After cloning git repository to directory "hggit" and setting the remote origin with

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

After editing files I committed the changes (while located in a sub-dir) with

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

I then attempted to push file changes and received the following error

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"'

解决方案

If git status does indicate that you do have an active master branch (since you did make a first commit after all), check if you made any typo when defining your remote: see "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@....

You can simplify with:

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

Then you can establish a tracking link between the local branch and the remote tracking branch:

git push -u origin master

You can also push it to a different branch on origin:

git push -u origin master:anotherBranch

这篇关于git:error:src refspec master不匹配任何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆