I am trying to nest a shell script into a Jenkins job but the script will infinitely get stuck when using the bash git clone command.
It doesn't even send me an error. I suspect the script is asking for a password when coming to the git clone command.
Jenkins Job Configuration :
#!/bin/sh
set -x
whoami #returns 'jenkins'
sudo -u root ./my_script.sh
my_script.sh
whoami #returns ROOT
sudo git clone 'https://myusername:[email protected]/project/my-project.git' -b "master" --verbose
What have I tried so far
- I edited my sudoers and added
jenkins ALL=NOPASSWD: ALL - I intentionnaly wrote wrong credential in the
git clonecommand, and I get an errorremote: HTTP Basic: Access denied - With a terminal, I went in my workspace project, switched to
jenkinsuser and ransudo ./my_script.shand it worked fine, no password asked. - It also work fine when ran under
rootuser ( not a surprise )
Does anyone know how I can get my job to make this command pass ?
Edit
I am on Mac OS

