Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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/stash does not point to a valid object!
error: refs/stash does not point to a valid object!
Current branch mybranch is up to date.

I have tried this solution but it doesn't work for me. Updated info:

$ GIT_TRACE=1 git pull 
trace: exec: 'git-pull'
trace: run_command: 'git-pull'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'ls-files' '-u'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'config' '--bool' 'branch.mybranch.rebase'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'rev-parse' '--verify' 'HEAD'
trace: built-in: git 'update-index' '-q' '--ignore-submodules' '--refresh'
trace: built-in: git 'diff-files' '--quiet' '--ignore-submodules'
trace: built-in: git 'diff-index' '--cached' '--quiet' '--ignore-submodules' 'HEAD' '--'
trace: built-in: git 'rev-parse' '-q' '--git-dir'
trace: built-in: git 'rev-parse' '-q' '--verify' 'refs/remotes/origin/mybranch'
trace: built-in: git 'merge-base' '53512e9ce3faa7c78b6d5d7ba1a63e56b5a42a11' 'refs/heads/mybranch'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'fetch' '--update-head-ok'
error: refs/stash does not point to a valid object!
trace: run_command: 'ssh' 'git@git-master' 'git-upload-pack '\''function-test'\'''
error: refs/stash does not point to a valid object!
trace: run_command: 'rev-list' '--verify-objects' '--stdin' '--not' '--all' '--quiet'
trace: run_command: 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
trace: exec: 'git' 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
trace: built-in: git 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
error: refs/stash does not point to a valid object!
error: refs/stash does not point to a valid object!
trace:...
like image 268
Jaime M. Avatar asked Dec 18 '13 16:12

Jaime M.


3 Answers

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
like image 192
mockinterface Avatar answered Nov 04 '22 00:11

mockinterface


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.

like image 41
Wildcard Avatar answered Nov 04 '22 02:11

Wildcard


I tried all of the recommended solutions, but nothing fixed it. What fixed it for me at the end was pretty simple:

# Made a small change in a code-file with vim

# stash'ed it then
git stash

# got it back
git stash pop

# reverted my small change
git checkout .

# finish, no more error
git pull

That might not work for everyone, and it might not work without following other fixes made earlier in here. But its worth a try.

like image 1
bandanh Avatar answered Nov 04 '22 00:11

bandanh