Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
526 views
in Technique[技术] by (71.8m points)

cygwin - Updating file permissions with git-bash on Windows 7

How do I update file permissions with git-bash on Windows 7?

I've tried the following without success:

$ ls -al scripts/script.sh
-rw-r--r--    1 myUid   Administ       70 Sep  8 11:24 scripts/script.sh

$ git update-index --chmod=+x scripts/script.sh

$ ls -al scripts/script.sh
-rw-r--r--    1 myUid   Administ       70 Sep  8 11:24 scripts/script.sh

$ chmod +x scripts/script.sh

$ ls -al scripts/script.sh
-rw-r--r--    1 myUid   Administ       70 Sep  8 11:24 scripts/script.sh
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You are probably using NTFS or FAT32 on Windows, and those filesystems do not support the executable permission. Instead, cygwin looks at the file name and contents to determine whether it's executable:

Files are considered to be executable if the filename ends with .bat, .com or .exe, or if its content starts with #!.

So you should make sure that the bash file starts with a shebang (e.g. #!/bin/bash). Then, you should be able to just execute the file, disregarding the permission output of ls.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...