Search code examples
gitmacosmacos-sierra

Write permission when cloning repository in OSX


Whenever I clone a repository using git in OSX Sierra, the default permissions for my applications are read-only. That means that if I open a file of the repo with my IDE of choice, I can't edit it. I know I can chmod 777 the file and then edit it, but it means I'm modifying the file and that counts as a change for git. In addition, doing that each time I clone a repo is an unnecessary mess.

So I have tried setting a custom umask to 000 (write, execute and read by default for all new files), but looks like files from cloned repos keep having read-only permissions.

Any idea on how to fix this? Thanks in advance.


Solution

  • So turns out I was using sudo everytime I cloned a repo, so the user got set to root. Using git clone without sudo solved the issue.