Setup 'git pull' to work without specifying a branch

I have received the following error message several times now on different projects from using 'git pull'.

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.

I always forget what to do and have to look up the solution.  The answer I have come to a few times now is here on Stack Overflow.  Basically, you have to configure git using the following commands:

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

Or this if you want to make the changes effect every repository and even future repositories.

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