CircleCI permission denied running bash script

samcorcos picture samcorcos · Nov 26, 2015 · Viewed 14.8k times · Source

I have a circle.yml file like so:

dependencies:
  override:
    - meteor || curl https://install.meteor.com | /bin/sh

deployment:
  production:
    branch: "master"
    commands:
      - ./deploy.sh

When I push to Github, I get the error:

/home/ubuntu/myproject/deploy.sh returned exit code 126

bash: line 1: /home/ubuntu/myproject/deploy.sh: Permission denied Action failed: /home/ubuntu/myproject/deploy.sh

When I run the commands that live inside deploy.sh outside of the file (under commands) everything runs fine.

Everything in the circle.yml file seems to be in line with the examples in the CircleCI docs.. What am I doing wrong?

Answer

Tom Parker-Shemilt picture Tom Parker-Shemilt · Nov 29, 2015

Several possible problems:

  1. deploy.sh might not be marked as executable (chmod +x deploy.sh would fix this)
  2. The first line of deploy.sh might not be a runnable shell...

If the first doesn't work, can we please see the contents of deploy.sh?