0

I seem to have permissions issue with a git repository.

I git this error when I pull in a directory my Linux user did not create.

fatal: Unable to create '/home/---/.git/ORIG_HEAD.lock': Permission denied

My user is a member of a group called grp. I changed every file to grp:grp and I still cannot pull.

Is there any thought on why this happens? For what it's worth I changed the actual /git/REPOSITORY files also to grp:grp.

Of course, when I use sudo I can pull fine but I prefer not to do it this way.

TheLettuceMaster
  • 15,594
  • 48
  • 153
  • 259
  • What's your default umask? – spudone Oct 02 '14 at 23:21
  • 1
    If you used sudo once, you may have some files owned by root in there that're preventing you from writing. Run 'chown -R user:grp path/to/dir', where the path contains .git (i.e. path/to/dir/.git) – synthesizerpatel Oct 02 '14 at 23:26
  • @synthesizerpatel Hey that actually fixed the issue; but what about other users who pull to the same depository? I just changed it to mine? – TheLettuceMaster Oct 02 '14 at 23:28
  • 1
    My apologies, I missed that part. You'll have to set the sticky bit on it probably. 'chgrp user:group ;chmod 4775 ', then anyone in group will be able to read/write to it. not very secure, and possibly could be done better.. but that should do it. – synthesizerpatel Oct 02 '14 at 23:38
  • Possible duplicate of [Using Git without Sudo in many accounts](http://stackoverflow.com/questions/1367258/using-git-without-sudo-in-many-accounts) – Won Jun Bae Nov 10 '15 at 15:47

1 Answers1

3

User: root

1) rm -f ./git/ORIG_HEAD.lock

2) chown -R MY_USER_NAME ./git*

3) chgrp -R MY_USER_NAME ./git*

4) git pull