git pull origin master returns fatal: invalid refspec

Here is the problem:

Whenever I do

  • How to develop PHP packages in a team using composer?
  • Can I add custom colors to mercurial command templates?
  • Can I add a .gitignore file just for me that overrides the project .gitignore?
  • how to prevent unpushed submodules in git
  • Managing PDFs/binaries with Git or other VCS
  • Git: updating website when pushing to remote repository?
  • $ git pull ''

    followed by the url I get no problems but when I do

    git pull origin master ''

    followed by the url it returns

    fatal: Invalid refspec ''

    What does this mean and how should I go about fixing it?

  • What to do if git-am fails with “does not exist in index”?
  • Is it possible to pre-evaluate a value in bash's PS1?
  • gitignore - hide ignored files during checkout
  • Only master branch is visible after cloning a Git repo
  • How to “un-git-ify” my HD
  • How to checkout a commit's child?
  • 2 Solutions collect form web for “git pull origin master returns fatal: invalid refspec”

    If you have already established remote-tracking branches (i.e. git clone does this automatically) and want to use git pull with the intention of grabbing and merging the latest commits for the current branch off the remote repository, I believe that executing the following will suffice:

    git pull

    To achieve the same effect with the inclusion of a refspec (unnecessarily long-winded):

    // Pulls the remote 'master' branch down to the local 'master' branch
    git pull origin master:refs/remotes/origin/master

    You are receiving that error because the provision of a URL is not how the refspec is formatted.

    For further details on how the refspec works and its syntax, consult this chapter from the wonderful Pro Git book. Hope that helps!

    Please explain what your git pull origin master '' call is supposed to do (in your own mind)?

    If you’d like to pull the branch “master” from a repo using its explicit URL, then the command to call would be

    git pull master

    because “origin” is just a name of a so-called “named remote” which is sort of a configured alias for a repository which allows you to not type that repo’s URL each time you access it.

    The canonical call to git pull is

    git pull [<repo> [<refspec> ...]]

    where parts in [...] are optional — see the manual page.

    Git Baby is a git and github fan, let's start git clone.