Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't add file to git repository but can change / commit

Tags:

git

linux

here is error :

git add .emacs
error: insufficient permission for adding an object to repository database .git/objects

error: .emacs: failed to insert into database
error: unable to index file .emacs
fatal: adding files failed

how can I fix it ? what's wrong with it ?

like image 618
cnd Avatar asked Nov 29 '22 03:11

cnd


1 Answers

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

That is your problem. For some reason or another, Git is having trouble writing to .git/objects - typically this means it is owned by another user and doesn't have the proper permissions.

Try seeing what permissions the folder currently has by running ls -l .git/objects. Then, you can chmod or chown (or both) as necessary.

like image 98
Amber Avatar answered Dec 09 '22 09:12

Amber