开发者

How do i set a private ssh key for hudson / jenkins to access bitbucket?

I'm trying to set up a Debian server with Apache2 as a front end to Tomcat 7 running Jenkins - which is working - but i want Jenkins to monitor a private Mercurial repository hosted at bitbucket and I'd like to use SSH. (I've tried with plain https but still no joy - there is a question answer here on SO that recommends using ssh)

I'开发者_Python百科ve deployed Jenkins using the hot deploy capability of Tomcat by dropping the Jenkins .WAR file into /webapps. I can generate a public/private key pair on the server and have added my public key to the bitbucket account - but how do I make Jenkins use my private key to authenticate when accessing a private repository on bitbucket?

I've seen a blog post that uses apt-get to install Hudson on Debian which creates a Hudson user (so i could add a private key for this user) but installing it via the tomcat autodeploy doesn't add a Jenkins user. If there is no unix user set up for Jenkins, can I configure one that Jenkins would use when authenticating?


If you can control the mercurial command line from within Jenkins you can pass the --ssh command to tell mercurial what ssh command to invoke. Something like this would probably work:

hg --ssh '/usr/bin/ssh -i /path/to/private/key' ...

Alternately you can figure out what user Jenkins is running as (it's got to be some user) and put the file in that user's ~/.ssh even if that's /root/.ssh/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜