Reputation: 213193
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:
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
?
Upvotes: 1
Views: 42
Reputation: 1323135
644 and 755 are the only tow permissions recorded by Git.
sudo
should not be used usually, unless you are in a common server (accessed by multiple users) where the local repo is not created as you.
If it is your repo, try a:
sudo chown -R <yourUser> .
And see if the error persist on git pull
.
Upvotes: 1