One more thing can stop a command before it even starts.
File permissions
Also called rwx, chmod, sudo, root
Rules saying who may read, write and run each file. ls -l shows them as -rwxr-xr--: three letters for the owner, three for a group, three for everyone else. chmod changes them. root, the administrator account, ignores most of them.
A script an agent writes can't run until it is marked executable, so Permission denied usually calls for chmod +x, not sudo. Be wary when an agent reaches for sudo or chmod 777. They don't fix the problem. They remove the protection that reported it.
“Permission denied on scripts/deploy.sh means it isn't executable. Run chmod +x scripts/deploy.sh and commit that. Don't use sudo or chmod 777. If you think you need to, stop and ask me.”