1

Hopefully there is some setting in git config for this...

Our project team chooses to store eclipse .project and .classpath settings in the git repository. Now, ignoring wether or not storing these files in the SCM is good or bad -- the problem is when the repository is cloned under windows any filename starting with a dot '.' is set as a system file, making it read-only which causes eclipse to spew errors when trying to update projects.

Could not write file: D:\git\SFP\framework\Auth_Server\.classpath.
D:\git\SFP_convert\framework\Auth_Server\.classpath (Access is denied)

So, how do I stop git from setting files starting with a dot '.' as system/read only?

Jon
  • 475
  • 2
  • 10
  • 17

2 Answers2

1

Git shouldn't change those permission, and dotfiles aren't always considered as "system files" in read-only.
Case in point: a .gitignore present in most repo should be perfectly writable when the repo is cloned, even on Windows.

Git only stores two permissions (755=rwxr.xr.x, 644=rw.r..r..).

One way is to make sure to commit in a repo with git config core.filemode false.

But for a repo which already contains files with the incorrect permission, you need to make a new commit with those same files with the right 755 permission.
You can use a reverse patch or git-meta-cache.


The OP Jon reports:

We are currently using msysgit 1.6.5. upgrading to match the git version on the server (1.7.9) has fixed the problem.

I would recommend also to upgrade to the latest available (1.8.4 Sept. 2013)

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Checking git config shows me core.filemode is already set to false. So i created a new repository, created a new file named ".file" and added our standard .gitignore. Pushed the changes to our central server, and re-cloned the repo in a new location. Both files were created with the "hidden" attribute turned on. – Jon Sep 17 '13 at 17:49
  • @Jon can you try in a [git bash](http://stackoverflow.com/a/17810334/6309) (and not git cmd) to type: `umask 002` and clone that repo, and check the right of the files? – VonC Sep 17 '13 at 17:52
  • re-cloning after umask 002 gives the same results Update: checking core.filemode on the server displays as 'true' – Jon Sep 17 '13 at 18:04
  • @Jon can you clone after a `git config --global core.filemode false`? – VonC Sep 17 '13 at 18:05
  • I ran git config --global core.filemode false on the server. then added a new file named ".file1" commit+push. then re-cloned to a new folder. Everything still shows up with the system attribute turned on – Jon Sep 17 '13 at 18:17
  • @Jon can you try that (add + push) in a `git bash`, where `umask` is set to `002`, and check with a `ls -alrt` that said file (you have added) is writable before the push? – VonC Sep 17 '13 at 18:26
  • Some more testing: on the newly cloned repo. Git bash shows all the '.' files as "-rw-r--r--" yet windows explorer shows the files with the system attribute turned on. I created 2 new files from git bash "file" and ".file" both show identical permissions prior to commit. both are writable with "-rw-r--r--" Also when doing a commit both show "create mode 100644" Yet when I re-clone ".file" is created with the system attribute turned on. – Jon Sep 17 '13 at 18:51
  • @Jon Strange. Can you try it with the latest msysgit 1.8.4 (released yesterday)? – VonC Sep 17 '13 at 18:54
  • We are currently using msysgit 1.6.5. upgrading to match the git version on the server (1.7.9) has fixed the problem. – Jon Sep 17 '13 at 20:14
  • @Jon Excellent. I have included your conclusion in the answer for more visibility. – VonC Sep 17 '13 at 20:51
0

This problem occurs when we copy the project from system to other system then some file are automatically hidden.You go in your project directory and in this project directory. some folder and file have a hidden attribute so un-check hidden attribute in all file and folder and now import project.

jeetendra
  • 1
  • 1
  • Thats fine for 1-off changes. but it quickly becomes impractical when projects are updated on a daily basis and they contain hundreds of of these files spanning thousands of folders – Jon Jun 24 '14 at 22:42