git pull 失败“错误:引用/存储未指向有效对象!”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20663239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git pull fails 'error: refs/stash does not point to a valid object!'
提问by Jaime M.
git pull is giving this error:
git pull 给出了这个错误:
$ 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 solutionbut it doesn't work for me. Updatedinfo:
我已经尝试过这个解决方案,但它对我不起作用。 更新信息:
$ 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:...
回答by mockinterface
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
回答by Wildcard
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.5state:
Git 1.8.5.5 版本的发行说明:
- "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.
- “git clone”将无法从直接在“refs/”下具有引用的存储库进行克隆,例如“refs/stash”,因为不同的验证路径对这样的引用名称执行不同的操作。放松客户端的验证以允许这样的引用。
I found that one of the servers was using Git 1.7.1 and the other was using Git 1.8.5.6.
我发现其中一台服务器使用 Git 1.7.1,另一台使用 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.
值得注意的是,该fetch
命令也会失败,尽管在上面的发行说明中没有明确提到。
In my particular case I also found that the server with Git 1.7.1 actually hadthe later Git as well, but it was later in the PATH
environment variable.
在我的特殊情况下,我还发现带有 Git 1.7.1 的服务器实际上也有较晚的 Git,但它在PATH
环境变量中较晚。
It may be of interest that when I ran git fetch
using the later version, the clone thereafter worked even with the older version.
有趣的是,当我git fetch
使用更高版本运行时,此后的克隆甚至可以与旧版本一起使用。
The simplest solution is just to upgrade Git to version 1.8.5.5 or later.
最简单的解决方案就是将 Git 升级到 1.8.5.5 或更高版本。
Or, of course, drop the stash, but then your clone will break again next time someone makes a stash.
或者,当然,放下藏匿处,但是下次有人进行藏匿时,您的克隆将再次损坏。