Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File permission issue with Mac/Windows when using git

I ran the following code to pull files from windows git repository.

git pull /Volumes/sucho/Desktop/git/setup

And I connect the Windows directory as follows.

tell application "Finder"
    mount volume "cifs://WINDOWS/c$/Users/sucho" as user name "USR" with password "PW"
end tell

It works well, but the problem is the pulled files from windows have 700 (rwx------). How can I set it 644(rw-r--r--) as default?

like image 558
prosseek Avatar asked Aug 30 '10 19:08

prosseek


People also ask

How do I give git permission in Windows?

TL;DR The following Git command is chmod +x equivalent. You can run it on your Windows machine and the permission is reflected to git repo once you commit the change.

Does git have file permissions?

Yes, by default, git is configured to track the changes in file permission mode, too.


2 Answers

This isn't really answering your original question, but I hope to highlight another issue I ran into when attempting to trying @drewag's proposed solution...

Another issue I ran into when attempting to ignore file permissions, regardless of whether it was on a Windows or Mac machine (more prevelant on the Windows machine!), was the problem global vs. project-level configurations.

Running this command did not affect the .gitconfig file in my C:\Users\Username folder:

 git config core.filemode false

Although adding the --global flag did affect the change I was looking for:

 git config --global core.filemode false

Hope this helps someone solve some of their headaches!

like image 154
Chris Kempen Avatar answered Oct 19 '22 10:10

Chris Kempen


If you don't care about file permissions, you can just tell your repository to ignore file permission:

git config core.filemode false
like image 41
drewag Avatar answered Oct 19 '22 10:10

drewag