Recently I came across permission related issue for a file in git. Actually one of my team members while committing a file didn't notice there is no write permission for group level.
Consider a file - file.txt
. She committed and pushed the file, while the permission on her machine was - 644 (rw-r--r--)
. And when I tried to do a git pull
, it returned with following error for that file:
$ git pull
error: unable to create file file.txt
So I did try a couple of things without success:
- First I changed the file permission on my team member machine, and pushed it again. But that didn't help.
- Then I deleted the file, and re-created it with proper permission. And then added the new file to git. Again, that didn't work.
Finally I've to resort to use sudo
:
$ sudo git pull
And that did work. But I'm still unknown about how to fix the issue without using sudo
?