But it turns out the solution is quite easy. So I am sharing it here, so it can maybe help you (or me) in the future.
The solution is the Git update-index command.
To set the execute permission you can use this command:
git update-index --chmod=+x path/to/file
To remove it, use:git update-index --chmod=-x path/to/file
This will assign execute permission to the selected bash file. The only thing missing is to push the changes to the Git repository.Deeper look
Let's check what is happening here underhood. Under the hood, Git doesn't have a unix files permission system. In reality, Git maintains a special "mode" for each file in its internal storage:100644
for all regular files100755
for executable files
To check file's file mode you can use ls-files command with the option
--stage
:$ git ls-files --stage
100644 1ff0c423042b46cb1d617b81efb715defbe8054d 0 .gitattributes
100644 3c4efe206bd0e7230ad0ae8396a3c883c8207906 0 .gitignore
100755 1a82e9a4560497d8c6e273c61bfd01995524d58f 0 my_executable_script.sh
Thank you for reading, I hope this will help someone.
Click on the link provided to read further posts of this kind.
ReplyDelete