I have created an Amazon Alexa Skill and I have also added ask-cli support to it. When I was trying to deploy it using ask-cli an error came i.e.
/bin/sh: 1: hooks/pre_deploy_hook.sh: Permission denied
[Error]: Hook Scripts failed
Then, I opened Powershell as administrator and run the following command:
Set-ExecutionPolicy Unrestricted
After that I successfully deployed the skill from my system. Then I uploaded my project at gitlab and want to deploy it from gitlab CI/CD whenever a commit occurs in master branch. But it's showing the same hook script error. Then, I changed my .gitlab-ci.yml file for just changing the policy and not deploying the skill. Then again an error occurred.
Now, I want to deploy my skill throught gitlab ci/cd whenever a commit occurs in master branch and for that I need to set Exection Policy to Unrestricted. Please tell me how can do that.
Note that the error message is complaining about a *.sh
file, implying a Unix shell script (typically, a POSIX-like shell such as sh
or bash
), whereas Set-ExecutionPolicy
applies exclusively to PowerShell scripts (*.ps1
) - and isn't supported on Unix-like platforms at all.[1]
Specifically, the Permission denied
error suggest that script file hooks/pre_deploy_hook.sh
isn't executable (doesn't have executable permissions).
To make it executable (by anyone), run something like:
chmod a+x .git/hooks/pre_deploy_hook.sh
from your project folder.
[1] On Unix-like platforms, PowerShell's execution policies don't apply: in Windows terms, it's as if the Bypass
policy were in effect (even though Get-ExecutionPolicy
reports Unrestricted
). An attempt to set the policy makes Set-ExecutionPolicy
fail with Operation is not supported on this platform
, as shown in your screenshot.