Search code examples
jenkinsgit-stashbitbucket-server

Jenkins stash integration with ssh


I will appreciate if anyone can point me to how to setup Jenkins for Stash repo, no need for webhooks or plugins(I think), its for testing and I'll just like to manually trigger a build. I used stash repo URL ssh://git@stash.xxxxxx:xx/xx/xx.git with my stash credential but got error "stderr: Host key verification failed. "


Solution

  • On your Jenkins master, you need to generate a public key for the jenkins user (or the owner of the jenkins process):

    ssh-keygen -t rsa (with no paraphrase)
    

    Next, go to ssh folder ~/.ssh and copy the content of the id_rsa.pub file.

    With Stash, go on the relevant project/settings/Access keys.

    Paste your public key and choose read or read/write access.

    It should solve your issue :)