From windows 7 environment, After created a build.sh file and pushed it to original, but the project's build failed:
./build.sh: Permission denied
. The cause is this build.sh doesn't have execute permission. So I need to add +x permission to it, on windows?Solution:
As we know, Git manages file permissions for each file in the repository, so we need to have the executable bit set for shell/bash files to make them executable in Linux System. But on windows, file permissions do not map to the Git file permissions, so it may be a bit hard to change the file permissions. Here are the steps:
- check current file permission:
C:\Git\myProject>git ls-tree HEAD
100644 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe build.sh
- change it to 755:
C:\Git\myProject>git update-index --chmod=+x build.sh
- commit our change:
C:\Git\myProject>git commit -m "Changing file permissions"
[master 77b171e] Changing file permissions 0 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build.sh
- check permission again:
C:\Git\myProject>git ls-tree HEAD
100755 blob 55c0287d4ef21f15b97eb1f107451b88b479bffe build.sh
- push
git push origin master
No comments:
Post a Comment