Jenkins logo

A few notes on getting Jenkins-CI installed on your Mac and setup with Git and Bitbucket for source code management. I’ve been using Git for some time but I had problems / major issues with Jenkins and could never seem to get this working.

Issues with setting up Jenkins and Git on a Mac

Here are the issues I was having - the biggest issue was the Error (unable to clone) which showed up when I created a job and added the path to the Bitbucket repo - even after I had added the SSH Key to Bitbucket. It was driving me mad!

  • can’t pbcopy the ssh-key from terminal for the jenkins user
  • can’t run the job even though you add the ssh-key to BitBucket
  • error message tells you can clone and is not helpful!

How to Install Jenkins on a Mac with Git

  1. Run the Jenkins-CI installer
  2. Go to System Admin > Users
  3. Create a username and password for the Jenkins user (make it an admin user too - just in case)
  4. Logout - Login in as Jenkins
  5. Go to Bitbucket.
  6. Go to your Account > SSH Keys
  7. Open Terminal on Mac
  8. Run ssh-keygen
  9. Copy your SSH Key from Terminal pbcopy < ~/.ssh/id_rsa.pub
  10. Paste this to Bitbucket and save.
  11. Go to your repo and copy it’s ssh path
  12. Paste this to Terminal
  13. Yes to add the SSH Host to your known list
  14. Now go to Jenkins
  15. Add / Edit Job
  16. Paste your ssh path
  17. Error is gone!
  18. Voila

Note - the key point is that the SSH Host has to be added to the allowed hosts for the user jenkins - if the SSH Host (Bitbucket) is not added, then Jenkins can’t figure out how to type Yes (step 13).