Reputation: 1024
I set up a subdomain on my DO droplet which is running Jenkins.
I want Jenkins to deploy my project when a new build is pushed to my GitLab master branch.
The problem is that I am getting a [email protected]: Permission denied (publickey)
error.
The issue is that when running git pull
on my ubuntu droplet, everything is working perfectly, so my ssh keys should be working fine. But when executing a shell on BUILD, I am running into this error.
I also have to run sudo git pull
or I am getting a cannot open .git/fetch_head permission denied
error. Again when running all of these commands on my DO ubuntu droplet.
Am I supposed to set up another SSH key on the Jenkins GUI?
EDIT: I am using user jenkins, which is default Jenkins user.
Upvotes: 1
Views: 307
Reputation: 116
When you are manually running git pull
on the droplet, are you running as the same user as Jenkins? You might need to add the ssh key for a different user. I believe by default, Jenkins runs under a jenkins
user.
Upvotes: 1