sudo su - jenkins
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- Log in with Jenkins user
sudo su - jenkins
- Generate SSH Key
ssh-keygen
- Let the default options
hydrogenium:~ jenkins$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/Shared/Jenkins/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
For simplicity, no password was given
- Copy the public key
cat /Users/Shared/Jenkins/.ssh/id_rsa.pub
- Go to GitHub and add the public key as a deploy key
sudo addgroup -g 1000 jenkins
sudo adduser -G jenkins -D -H -u 2000 jenkins
# And create the jenkins directory
sudo mkdir -p /jenkins/home
sudo chown jenkins:jenkins /jenkins
JENKINS_HOST=host:port
curl -sSL "http://$JENKINS_HOST/pluginManager/api/xml?depth=1&xpath=/*/*/shortName|/*/*/version&wrapper=plugins" | perl -pe 's/.*?<shortName>([\w-]+).*?<version>([^<]+)()(<\/\w+>)+/\1 \2\n/g'|sed 's/ /:/'