Assign execute permissions with Git

Published: 24 January 2016

Recently I had to configure a build on Jenkins for the work I am doing at Auth0 and ran into an issue with a shell script that did not want to execute and failed with a “Permission Denied” error.

Being new to the Linux world I reached out to a colleague and it turned out the solution was an easy one. It is new for me, so I am sharing it so it can maybe help you in the future.

The solution is to use the Git update-index command to assign the execute permissions.

Let’s say the bash script in question is named, then go to your shell (or Git shell if you’re on Windows like me) and execute the following command:

git update-index --chmod=+x

This will assign execute permissions to the bash file. After that you can commit the changes to the repo.

Hope this helps someone out there :)

PS: If you found this content valuable and want to return the favour, then please feel free to ☕ buy me a coffee