Git file permissions on Windows

I've read through a few questions regarding file permissions in Git and I'm still a bit confused. I've got a repo on GitHub forked from another. Post merge, they should be identical. However:

$ git diff --summary origin/epsilon master/epsilon
 mode change 100644 => 100755 ants/dist/sample_bots/csharp/compile.sh
 mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/MyBot.coffee
 mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/ants.coffee
 mode change 100644 => 100755 ants/util/block_test.sh
 mode change 100644 => 100755 manager/mass_skill_update.py
 mode change 100644 => 100755 worker/jailguard.py
 mode change 100644 => 100755 worker/release_stale_jails.py
 mode change 100644 => 100755 worker/start_worker.sh

I've tried changing file permissions, but it does not alter the diff results.

What should I do?

edit : this problem was caused/compounded by the fact that I was using git on an ubuntu VM guest with the repo hosted on the shared Windows 7 host. This was a recipe for disaster. The answers here seem reasonable to me, but I cannot award a tick because they answer a problem which I didn't have.


I found the solution of how to change permissions (also) on Windows here: http://blog.lesc.se/2011/11/how-to-change-file-premissions-in-git.html

For example following command adds user execute permission to an arbitrary file:

git update-index --chmod=+x <file>

From another question here on stackoverflow: How do I make Git ignore file mode (chmod) changes?

Try:

git config core.filemode false

From git-config(1):

   core.fileMode
       If false, the executable bit differences between the index and the
       working copy are ignored; useful on broken filesystems like FAT.
       See git-update-index(1). True by default.

Handy one-liner for Git Bash:

find . -name '*.sh' | xargs git update-index --chmod=+x

It will mark all .sh file as executable. After that, you just have to git commit .

链接地址: http://www.djcxy.com/p/30012.html

上一篇: 似乎无法放弃Git中的更改

下一篇: Windows上的Git文件权限