Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: Trying to write ref HEAD with nonexistant object

Tags:

git

I'm trying to clone a repo but can't. Here's what I get:

username@dev:~$ sudo git clone username@localhost:reponame reponame
Initialized empty Git repository in /home/username/reponame/.git/
username@localhost's password:
remote: Counting objects: 1017, done.
remote: Compressing objects: 100% (425/425), done.
remote: Total 1017 (delta 490), reused 967 (delta 467)
Receiving objects: 100% (1017/1017), 18.44 MiB | 26.02 MiB/s, done.
Resolving deltas: 100% (490/490), done.
error: Trying to write ref HEAD with nonexistant object 650847310778421960977df632ede735af9e9b86
fatal: Cannot update the ref 'HEAD'.

Trying to clone a repository in git, getting a error has a few recommendations but I'm not trying to clone to an existent folder - I'm trying to clone to a new folder and obviously I'm not going to be able to add a remote to something that isn't even a git repo.

If I do it with a different username it works just fine. Just not this newly created user.

Any ideas?

like image 843
neubert Avatar asked May 21 '26 16:05

neubert


1 Answers

It sounds as though somehow HEAD is pointing at a non-existent object. Do you have any other branches? what happens if you do

git clone -b BRANCH username@localhost:reponame reponame
like image 187
Ilion Avatar answered May 23 '26 04:05

Ilion