Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Error :

fatal: cannot update the ref ‘HEAD’: unable to append to ‘.git/logs/HEAD’: Permission denied
Solution:
The error you’re seeing:
fatal: cannot update the ref 'HEAD': unable to append to '.git/logs/HEAD': Permission denied
means that your current user (demon
) does not have write permission to the .git/logs/HEAD
file or possibly other files inside the .git
directory.
โ How to Fix It:
๐ง Option 1: Fix permissions recursively
Run the following command to give the current user ownership of the .git
directory and all its contents:
sudo chown -R $(whoami):$(whoami) .git
If you’re sure demon
is the right user, you can also use:
sudo chown -R demon:demon .git
๐ง Option 2: Check .git/logs/HEAD
permissions directly
You can also fix just that file:
sudo chmod u+rw .git/logs/HEAD
Or, again change ownership:
sudo chown demon:demon.git/logs/HEAD
๐ Then, try committing again:
git commit -m "adding"