I recently set up a new repository on github. Creating the repository on github yields a page of instructions covering the two common scenarios: new and existing repositories. After following the new repository instructions, I had a repository on github, a local repository, and the following in response to my git pull command:

You asked me to pull without telling me which branch you want to merge with, and 'branch.master.merge' in your configuration file does not tell me either.  Please name which branch you want to merge on the command line and try again (e.g. 'git pull <repository> <refspec>'). See git-pull(1) for details on the refspec.
If you often merge with the same branch, you may want to configure the following variables in your configuration file:
  branch.master.remote = <nickname>
  branch.master.merge = <remote-ref>
  remote.<nickname>.url = <url>
  remote.<nickname>.fetch = <refspec>
See git-config(1) for details.

Not exactly what I wanted, and certainly not what I expected. What I expected was a local repository with the upstream for master to be set to point at master on the github repository.

Setting this up can be done easily in two similar ways:

I opted for git config as it was easier and required no thinking — the commands are always the same1; here they are:

% git config branch.master.remote origin
% git config branch.master.merge refs/heads/master

1 For the scenario of a local empty repository pushed up to a remote, where the remote will be the upstream master.

blog comments powered by Disqus