git fetch insufficient permission for adding an object to repository database .git/objects?
Asked Answered
R

1

11

In my repo in my home directory (on an Ubuntu box) I did

 git fetch

I unfortunately got an error about:

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

There's a gazillion directories in .git/objects and all of them appear to be 775. The few spot checks I did show the files to be 664.

I went and did a

 chmod -R 777 .git/objects 

which fixed the problem but now I've got a bunch of files 777 on my box and I'm sure that's a no-no.

What should the correct permissions be and how can I easily get all 10 million files and directories set correctly?

Thanks in advance.

Rappee answered 25/10, 2012 at 17:54 Comment(0)
S
27

Are you the owner of all the files?

Try

chown -R you:you .git

Then chmod them to "normal"

chmod -R u=rwX,g=rwX,o=
Schlesien answered 25/10, 2012 at 18:0 Comment(3)
On Mac: chown -R you:staff .git was enough in my caseBurkitt
On Mac: chown -R user .git was also enough in my caseTav
Just encountered this on a local repo that was previously working fine, no permissions/group changes that I know of. What in the world caused this?Cyclometer

© 2022 - 2024 — McMap. All rights reserved.