0

Possible Duplicate:
Getting rid of ‘… does not point to a valid object’ for an old git branch

When I try to clone a project from GitHub I have following error:

$ 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'.

I expect it's a common issue but surprisingly everything I found on google was assuming .git directory is there. From my understanding .git is always local to a project and it this case it's failing to download it. I tried it on a different server and it works.

Strangely when I try to clone anything else there is no problem.

$ 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.

I would like to understand what is so special about this particular project on this particular server it's unable to clone it.

EDIT1:

git clone with 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'.

EDIT2:

$ git --version
git version 1.7.9.1
Community
  • 1
  • 1
Lukasz Kujawa
  • 3,026
  • 1
  • 28
  • 43
  • FWIW I can clone it so it's not a repository problem. – koopajah Dec 05 '12 at 15:31
  • Same error on git version 1.7.0.4; but git version 1.8 works fine. Some will tell you the reason for this in the answers I think. – soulseekah Dec 05 '12 at 15:37
  • If you get this error, `.git` should be there. Are you sure `.git` is absent? Is this a fresh clone in a new dir? – Andrejs Cainikovs Dec 05 '12 at 15:38
  • Run with `GIT_TRACE=2 git ...` and paste that, too, providing more information to solve this, although looks like @AndrejsCainikovs has the correct answer. – soulseekah Dec 05 '12 at 15:41
  • @soulseekah done. I've added output to the bottom of my question – Lukasz Kujawa Dec 05 '12 at 15:47
  • Strange, the repository does appear to be fine though, object `3985...2efd` is the last commit to master, and after cloning with git 1.7 `* 3985fe8 (HEAD, origin/master, origin/HEAD, master) Service add interface` regardless of the errors. `origin` is set to `ref: refs/remotes/origin/master`; maybe it's due to version mismatches, although I would expect basic back-compatibility. See http://stackoverflow.com/questions/10723081/issues-cloning-from-github – soulseekah Dec 05 '12 at 16:11
  • There are a lot of related questions http://stackoverflow.com/questions/10097069/fatal-error-after-github-automatic-merge, http://stackoverflow.com/questions/8404882/cloning-error-when-checking-out-private-github-repo look for the `refs/remotes/origin/master does not point to a valid object` error when searching, rather than `Cannot update the ref 'HEAD'`, which just the effect of the first error. – soulseekah Dec 05 '12 at 16:25
  • What version of git are you using? Try upgrading your client. – Chronial Dec 05 '12 at 16:12
  • $ git --version git version 1.7.9.1 – Lukasz Kujawa Dec 05 '12 at 16:13
  • Updating the client to 1.8 surely works as I pointed out in my comments above. More interesting is the question of why this happens. – soulseekah Dec 05 '12 at 16:14
  • As little as updating to `git 1.7.9.5` worked for me. – soulseekah Dec 05 '12 at 16:15
  • I have this problem when comitting my .net project, and I after close the visual studio, the commit success – yu yang Jian Apr 13 '17 at 06:49

0 Answers0