可能重复:
摆脱旧 git 分支的“...不指向有效对象”
当我尝试从 GitHub 克隆项目时,出现以下错误:
$ git clone https://github.com/lukaszkujawa/Beehive.git
Cloning into Beehive...
remote: Counting objects: 149, done.
remote: Compressing objects: 100% (114/114), done.
remote: Total 149 (delta 31), reused 132 (delta 15)
Receiving objects: 100% (149/149), 108.13 KiB | 131 KiB/s, done.
Resolving deltas: 100% (31/31), done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistant object 3985fe8fad9d1480fb76d849ba4dbbdebfee2efd
fatal: Cannot update the ref 'HEAD'.
我预计这是一个常见问题,但令人惊讶的是,我在谷歌上找到的所有内容都假设 .git 目录存在。据我了解,.git 始终是项目的本地文件,在这种情况下,它无法下载它。我在另一台服务器上尝试过它,它可以工作。
奇怪的是,当我尝试克隆其他任何东西时都没有问题。
$ git clone https://github.com/lukaszkujawa/php-mp3info.git
Cloning into php-mp3info...
remote: Counting objects: 23, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 23 (delta 8), reused 19 (delta 4)
Unpacking objects: 100% (23/23), done.
我想了解这个特定服务器上的这个特定项目有什么特别之处,它无法克隆它。
编辑1:
git clone 与 GIT_TRACE=2
$ GIT_TRACE=2 git clone https://github.com/lukaszkujawa/Beehive.git
trace: built-in: git 'clone' 'https://github.com/lukaszkujawa/Beehive.git'
Cloning into Beehive...
trace: run_command: 'git-remote-https' 'origin' 'https://github.com/lukaszkujawa/Beehive.git'
trace: run_command: 'fetch-pack' '--stateless-rpc' '--lock-pack' '--thin' 'https://github.com/lukaszkujawa/Beehive.git/' 'refs/heads/master'
trace: exec: 'git' 'fetch-pack' '--stateless-rpc' '--lock-pack' '--thin' 'https://github.com/lukaszkujawa/Beehive.git/' 'refs/heads/master'
trace: built-in: git 'fetch-pack' '--stateless-rpc' '--lock-pack' '--thin' 'https://github.com/lukaszkujawa/Beehive.git/' 'refs/heads/master'
remote: Counting objects: 149, done.
remote: Compressing objects: 100% (114/114), done.
trace: run_command: 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 9248 on vmserver01' '--pack_header=2,149'
trace: exec: 'git' 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 9248 on vmserver01' '--pack_header=2,149'
trace: built-in: git 'index-pack' '--stdin' '-v' '--fix-thin' '--keep=fetch-pack 9248 on vmserver01' '--pack_header=2,149'
remote: Total 149 (delta 31), reused 132 (delta 15)
Receiving objects: 100% (149/149), 108.13 KiB, done.
Resolving deltas: 100% (31/31), done.
error: refs/remotes/origin/master does not point to a valid object!
error: Trying to write ref refs/heads/master with nonexistant object 3985fe8fad9d1480fb76d849ba4dbbdebfee2efd
fatal: Cannot update the ref 'HEAD'.
编辑2:
$ git --version
git version 1.7.9.1