Alex Dai Playground

[Jenkins] bitbucket ssh key

| Comments

Linux

CLI

switch to jenkins user
$ sudo -i -u jenkins

create ssh key
$ ssh-keygen -t rsa

get public ssh key
$ cat ~/.ssh/id_rsa.pub

Add public key (id_rsa.pub) to bitbucket ssh key

Jenkins web ui

Credentials -> Add Credentials

  • Name -> jenkins@xxxxxxx ( fill from .ssh/id_rsa.pub )
  • Kind -> SSH Username with private key
  • Private Key -> From the Jenkins master ~/.ssh

Project -> Configure

  • Source Code Management -> git
  • Repositories -> Repository URL -> git@bitbucket.org:user/project.git
  • Credentials -> jenkins@xxxxxxx

Windows

CLI

git bash
$ cd c:/Users/User/
$ ssh-keygen -t rsa -C "youremail@emailhost"

Add public key (id_rsa.pub) to bitbucket ssh key

Jenkins web ui

Credentials -> Add Credentials

  • Name -> youremail@emailhost ( fill from C:\Users\User.ssh\id_rsa.pub )
  • Kind -> SSH Username with private key
  • Private Key -> Enter directly (copy & paste from C:\Users\User.ssh\id_rsa )

Done !

http://bookong.iteye.com/blog/1962400
http://stackoverflow.com/questions/15314760/managing-ssh-keys-within-jenkins-for-git

Comments

comments powered by Disqus