git pull origin master返回致命的:无效的refspec [英] git pull origin master returns fatal: invalid refspec

查看:825
本文介绍了git pull origin master返回致命的:无效的refspec的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题出在这里

每当我这样做

$ git pull'https://github.com/username/reponame.github.io.git'

后面跟着URL,我什么都没问题,但是

followed by the url I get no problems but when I do

git pull origin master'https://github.com/username/reponame.github.io.git'

后面跟着它返回的网址

致命:无效的refspec'https://github.com/username/reponame.github.io.git'

这是什么意思,我应该如何解决?

What does this mean and how should I go about fixing it?

推荐答案

如果您已经建立了远程跟踪分支(即 git clone 会自动执行此操作)并想使用 git pull出于获取和合并远程存储库中当前分支的最新提交的目的,我相信执行以下操作就足够了:

If you have already established remote-tracking branches (i.e. git clone does this automatically) and want to use git pull with the intention of grabbing and merging the latest commits for the current branch off the remote repository, I believe that executing the following will suffice:

git pull

通过添加refspec(不必要冗长)来达到相同的效果:

To achieve the same effect with the inclusion of a refspec (unnecessarily long-winded):

// Pulls the remote 'master' branch down to the local 'master' branch
git pull origin master:refs/remotes/origin/master

您收到此错误,因为提供的URL并非refspec的格式.

You are receiving that error because the provision of a URL is not how the refspec is formatted.

有关refspec的工作方式及其语法的更多详细信息,请参阅此 Pro Git书.希望有帮助!

For further details on how the refspec works and its syntax, consult this chapter from the wonderful Pro Git book. Hope that helps!

这篇关于git pull origin master返回致命的:无效的refspec的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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