git tries to use sensible defaults for git pull
based on the branch that you're currently on. If you get the error you refer to from git pull
while you're on master
, that means you haven't configured an upstream branch for master
. In many situations this will be configured already - for example, when you clone from a repository, git clone
will set up the origin
remote to point to that repository and set up master
with origin/master
as upstream, so git pull
will Just Work™.
However, if you want to do that configuration by hand, you can do so with:
git branch --set-upstream master origin/master
... although as of git 1.8.0 you should use --set-upstream-to
, since the former usage is not deprecated due to be confusingly error-prone. So, for git 1.8.0 and later you should do:
git branch --set-upstream-to origin/master
Or you could likewise set up the appropriate configuration when pushing with:
git push -u origin master
... and git pull
will do what you want.