fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Bad file descriptor

Viewed 5621

I am working on Robot framework Automation project. All of a sudden git commit does not work I get below error on commit command

**fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Bad file descriptor**

I am working on Windows machine. I have done 4 commits till now and code is in Repo. With the latest changes, commit is not happening with above error I have gone through few issues quoted in stack-overflow regarding this but I could get it resolved.

Please help me in overcoming this issue

I use the command git commit -a -m "description" or git commit -m "description"

None of the sudo command work for me it says

> $ sudo chown -R useremail .git/ 
> bash: sudo: command not found
2 Answers

It can happen when you accidently create a branch with root permission. Its best to check .git locally for ownership permissions i.e. ls -la .git/refs/heads/ should be owned by the user and not root.

Try the same command with:

You should not experience that bug again.

Related