Hanz
Hanz

Reputation: 519

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?

Upvotes: 0

Views: 2182

Answers (2)

VonC
VonC

Reputation: 1329672

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

Upvotes: 1

hd1
hd1

Reputation: 34677

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

Upvotes: 1

Related Questions