Programming/Coding

Git and Github Pull Configuration Error

This is a quick one. While doing some Photoshop and image work on blennd’s design, I was working on my local machine and was pushing my image files to github and pulling them down onto my server, when for some reason I ran into this error:

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
specify 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.

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.


I’m not sure why I was all of a sudden running into this, as I had already done pull’s before…. but whatever. Regardless, here’s the fix:
You can work around it by simply adding some parameters to each pull request:
$ git pull origin master
Or, you can correctly configure git to always pull from the master by:

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


Fixed. :)
I hope this helps anyone that runs into this.

  • Madhanraj M

    Hey, I got into this same error and this post was really helpful. Thanks a lot.

    • http://about.me/tnsuarez Rican7

      Absolutely. I’m glad I could help. :-)