fatal: cannot update the ref ‘HEAD’: unable to append to ‘.git/logs/HEAD’: Permission denied

Limited Time Offer!

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

Enroll Now

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"

Senior Software Development Engineer at Cotocus

Related Posts

Git Troubleshooting Advance Guides

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

Read More

All Git command

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

Read More

Top 10 Git interview Question

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

Read More

Git all Commands

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

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments