简体   繁体   中英

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 . Instead, I have to do git pull origin develop . Why is that so? Something is wrong with my git setup?

You've not configured a default remote for the branch. Do so using git pull origin -u develop .

Whether or not you have configured the default remote branch, the syntax of git pull is:

  • false in your question: 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. origin is.

  • false in hd1 's answer : git pull -u does not exists.

     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? ":

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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