简体   繁体   English

无法从远程git repo中提取

[英]fail to pull from remote git repo

I checkout to develop branch, and run git pull , I got error of fatal: 'develop' does not appear to be a git repository . 我检出develop分支,并运行git pull ,但出现fatal: 'develop' does not appear to be a git repository错误fatal: 'develop' does not appear to be a git repository Instead, I have to do git pull origin develop . 相反,我必须做git pull origin develop Why is that so? 为什么会这样? Something is wrong with my git setup? 我的git设置有问题吗?

You've not configured a default remote for the branch. 您尚未为分支机构配置默认遥控器。 Do so using git pull origin -u develop . 这样做使用git pull origin -u develop

Whether or not you have configured the default remote branch, the syntax of git pull is: 无论是否已配置默认的远程分支, git pull的语法为:

  • false in your question: git pull [<options>] [<repository> [<refspec>…​]] 在您的问题中为false: git pull [<options>] [<repository> [<refspec>…​]]
    That would be 那会是

     git pull origin develop NOT: git pull develop 

The first argument is the name of the remote repository, and, as the error message indicated, " develop " is not a remote repository. 第一个参数是远程存储库的名称,并且如错误消息所示,“ develop不是远程存储库。 origin is. origin是。

  • false in hd1 's answer : git pull -u does not exists. hd1答案为 false: git pull -u不存在。

     git push -u origin develop 

That last command would have establish a link between the local branch develop and the remote tracking branch origin/develop. 最后一条命令将在本地分支开发和远程跟踪分支源/开发之间建立链接。

In your case, since you want to pull and not push: 在您的情况下,由于您要拉而不是推:

git fetch
git checkout --track origin/dev

If the local branch develop already exists, see " Make an existing Git branch track a remote branch? ": 如果本地分支develop已经存在,请参阅“ 使现有的Git分支成为远程分支吗? ”:

git branch -u origin/develop develop
git checkout develop
git pull

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM