Search code examples
bashgitshellgithub-actionsworkflow

Git Action showing Permission Denied: I have an error when trying to read a JSON file


Git Action showing Permission Denied: I have an error when trying to read a JSON file.

Running

./src/script.sh '/home/runner/work/<Test>/<Test>/test.json'

I get the following error code:

/home/runner/work/_temp/********-***-***-***-*********.sh: line 1: /home/runner/work/<Test>/<Test>/test.json: Permission denied
Error: Process completed with exit code 126.

What permissions do I need to add?


Solution

  • As explained in the comments above, using the ls -l /path/to/file command showed that the file had reading permissions (-rw-r--r--).

    Using the chmod -x command to update the filesystem permission set locally, and pushing the file back with the updated permission to the repository resolved the issue.