Jenkins: How to build bitbucket private project

Categories: Development Notes; Tagged with: ; @ May 16th, 2015 12:10

Update on Jan 8, 2017

You may enter your private key directly in Jenkins “Configure Credentials”.  so that you don’t need to config your server/box.

Config your build server

0. su – jenkins  (sudo su -s /bin/bash jenkins) // no need for Windows

1. Generate RSA key:  ssh-keygen

2. Add public key to your bitbucket profile

for 1 and 2, You may follow this instruction:https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git

3. [Optional] try to do a git clone, make sure you can clone your project

 

Config your jenkins:

1. Install git plugin for you jenkins

2. config your jenkins job to use git repo: e.g.   [email protected]:user/project.git

Issues:

Failed to connect to repository : Command “git -c core.askpass=true ls-remote -h [email protected]:user/project.git HEAD” returned status code 128:
stdout:
stderr: Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You may add bitbucket.org to your know_host by executing:

git ls-remote [email protected]:accout/project.git
...
Are you sure you want to continue connecting (yes/no)? yes



// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.