I am unable to commit changes in my project when using git.
Here is my terminal:
tomas@tomas-laptop:~/menu_operations$ git commit -m "initial commit"
error: Unable to append to .git/logs/refs/heads/7.x-1.x: Permission denied
fatal: cannot update HEAD ref
menu_operations
is the name of my project.
I don't know what permission I have to allow. Can anybody help?
Check the user and permission on .git/logs/refs/heads/, maybe you ran something as root.
Explanation: when you run some git commands as root (sudo?) any new files/directories created will be owned by root, and by default[1] other users won't have write permission on these files/directories.
When you, later, work with that repository, things may appear to work, until the time that you need to write to a file that was in fact created by root, i.e. owned by root.
This should fix it, at least on linux:
sudo chown -Rc $UID .git/
It will also show you any files that it changed owners for.
[1]in a sane setup, at least
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With