Assign execute permissions with Git

less than 1 minute read

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 :)

Did you notice an error? Please help me and the other readers by heading over to the GitHub repo for this blog and submit a Pull Request with the corrections.