rowantran
rowantran

Reputation: 143

"unable to append to .git/logs/refs/heads/master" when commiting

I've been having some strange errors lately. I have a working install of Git, but this is my shell output when committing changes:

$ git commit -m 'Removing crap'
error: unable to append to .git/logs/refs/heads/master
fatal: cannot update HEAD ref

Upvotes: 2

Views: 7521

Answers (3)

John Ko
John Ko

Reputation: 19

The ownership can get messed up if you made changes as another user, e.g. root and then tried to push/pull etc. The sudo chown -Rc $UID .git/ fixed it for me too. Make sure that if you have nested .git folders, you make this change in the appropriate repo of your project.

Upvotes: 0

Pa Ddy
Pa Ddy

Reputation: 107

chmod 766 .git/logs/HEAD

worked for me

Upvotes: 2

Billjk
Billjk

Reputation: 10686

Check the user and permission on .git/logs/refs/heads/master

This should might fix it it, at least on a unix machine:

sudo chown -Rc $UID .git/

Upvotes: 6

Related Questions