git pull fails 'error: refs/stash does not point to a valid object!'

前端 未结 2 632
我寻月下人不归
我寻月下人不归 2021-02-07 14:52

git pull is giving this error:

$ git pull
error: refs/stash does not point to a valid object!
error: refs/stash does not point to a valid object!
error: refs/sta         


        
相关标签:
2条回答
  • 2021-02-07 15:31

    The simplest thing would be to completely remove your stash. Note that you’ll need to remove two files - not one file, as outlined in the linked solution:

    rm .git/refs/stash .git/logs/refs/stash
    
    0 讨论(0)
  • 2021-02-07 15:54

    I just ran into this error. Two servers were pulling a clone from the same source; only one of them gave this error. So I dug deeper.

    Git's release notes for version 1.8.5.5 state:

    • "git clone" would fail to clone from a repository that has a ref directly under "refs/", e.g. "refs/stash", because different validation paths do different things on such a refname. Loosen the client side's validation to allow such a ref.

    I found that one of the servers was using Git 1.7.1 and the other was using Git 1.8.5.6.

    It's worth noting that the fetch command would fail as well, though not explicitly mentioned in the release notes above.


    In my particular case I also found that the server with Git 1.7.1 actually had the later Git as well, but it was later in the PATH environment variable.

    It may be of interest that when I ran git fetch using the later version, the clone thereafter worked even with the older version.


    The simplest solution is just to upgrade Git to version 1.8.5.5 or later.

    Or, of course, drop the stash, but then your clone will break again next time someone makes a stash.

    0 讨论(0)
提交回复
热议问题