jenkins slave on mac directory not accessible
So the reason it works for "jenkins" user is because Jenkins creates a Application account with jenkins
user which has permissions to run/access Jenkins(and its folders- in your case -workDir "/Users/jenkins/jenkins_slave/"
). That is why jenkins
can run the command but when you try to run it with sudo it fails.
Why does it fail with sudo ?
That's mainly because there is directory higher in the tree where you do not have execute permission, so even with 777, you will still not be able to run it.
Instead do a chown
or usermod
on the directory to the user that you wish to get access
sudo usermod -a -G rohit git
for more information https://askubuntu.com/questions/812513/permission-denied-in-777-folder