Permission denied for build.sh file

PermissionsTravis Ci

Permissions Problem Overview


$ ./build.sh --quiet verify

/home/travis/build.sh: line 59: ./build.sh: Permission denied. 

The command "./build.sh --quiet verify" exited with 126. 

enter image description here

Permissions Solutions


Solution 1 - Permissions

Looks like you need to check in the file build.sh with execution permissions. Please try the following from your own machine:

git update-index --add --chmod=+x build.sh
git commit -m 'Make build.sh executable'
git push

Solution 2 - Permissions

You can grant the needed permission by adding this lines to the .travis.yml

before_install:
  - chmod +x build.sh

Solution 3 - Permissions

Run the script using bash

Another option would be to run the script using bash, this would omit the need to modify the files' permissions.

bash path/to/file.sh

Alternatively:

sh path/to/file.sh

Note that

In this case you're not executing the script itself, you're executing bash or sh which then runs the script. Therefore the script does not need to be executable.

Make sense?

Solution 4 - Permissions

simply run at the path where the build.sh file is

chmod +x build.sh

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAmit KumarView Question on Stackoverflow
Solution 1 - PermissionsjoepdView Answer on Stackoverflow
Solution 2 - PermissionsUladzimir ShchurView Answer on Stackoverflow
Solution 3 - PermissionsJesse van der PluijmView Answer on Stackoverflow
Solution 4 - PermissionsBoluwatife FakoredeView Answer on Stackoverflow