Configure Jenkins to connect to BitBucket

2019-02-16 01:57发布

I'm trying to configure Jenkins on my Mac Mini in order to pull the code of my iPhone App from my BitBucket repository. In the "Xcode plugin" configuration area I have tried to add the git address of my project but it keeps on failing. After a research it looks like I have to use an ssh deployment key to connect Bitbucket and Jenkins. What I have done so far:

ssh-keygen -t rsa 

pbcopy <  /Users/jenkins/.ssh/id_rsa.pub

and I added this SSH key to my BitBucket profile.

Unfortunately it still doesn't work.

Can anybody explain in detail the whole process?

2条回答
【Aperson】
2楼-- · 2019-02-16 02:13

Ok maybe I found the solution here: http://colonelpanic.net/2011/06/jenkins-on-mac-os-x-git-w-ssh-public-key/

Remember to re-generate the keys with:

ssh-keygen -t rsa 

to copy it with:

pbcopy <  /Users/Shared/Jenkins/Home//.ssh/id_rsa.pub

to upload it in BitBucket and run:

ssh git@bitbucket.org

in order to add bitbucket among the known hosts

查看更多
你好瞎i
3楼-- · 2019-02-16 02:26

I think the problem is in the permission for git. In the error log the command which is failing is

/usr/local/git/bin/git clone --progress -o origin git@bitbucket.org:myname/myproject.git/Users/Shared/Jenkins/Home/jobs/MyProjectAdHocBuild/workspace

If I try to run it in the console I get this:

fatal: could not create work tree dir '/Users/Shared/Jenkins/Home/jobs/MyProjectAdHocBuild/workspace'.: Permission denied

so if I run it in SUDO mode it works.

How can I give to Jenkings the permission to run git in Admin mode?

查看更多
登录 后发表回答