Error: insufficient permission for adding an object to repository database .git/objects

In this article let’s discuss about Error: insufficient permission for adding an object to repository database .git/objects. Let’s go through the following methods without any delay.

Method 1:

find .git/ -exec stat --format="%G %n" {} + |grep root

chown -R $(id -un):$(id -gn) .git/objects/

git commit -a -m "fixed git objects ownership"

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar by have a try!

Method 2 :

sudo chown -R www-data .

Hope the above solution works.

Realted Posts : How to use sed output to overwrite existin file