This is an short tutorial how to fix an gradlew permission denied error
When you run gradlew command with any task, You got following error in windows as well as linux
$ ./gradlew compile -bash: ./gradlew: Permission denied
gradlew: Permission denied is an permission error on linux or unix machine, So you have to change permissions for gradlew wrapper command.
First check avialiable permissions for the file using below command
$ ls -l gradlew
We can do in different ways using below approach
Change the permissions to be executable with
$ chmod +x gradlew
This works with local installation gradlew command.
Suppose same project used by multiple developers from repository and everyone has to do the same command to change permissions.
Instead, You can update permissions to git repository Second approach,
Here are the steps to do in git repository to commit changes
To change the permissions, change the git work tree to update permissions with below command
git update-index --chmod=+x gradlew
Add these changes using below command
git add .
Next commit changes to local repository using below command
git commit -m "Update execute permission for gradlew command"
finally, push the changes using push command to remote repository
permissions issues in gradlew are happening due to no executable permissions for gradlew command.
update execute permission using locally or globally repository.