[users at bb.net] Using SSH keys with GitPoller and Git step?

Pieter Lexis pieter.lexis at powerdns.com
Thu Mar 2 12:47:28 UTC 2017


Hi Chris,

On Wed, 1 Mar 2017 20:18:31 -0500
Chris Spencer <chrisspen at gmail.com> wrote:

> How do you specify the ssh key to use with the Gitpoller and Git step
> classes?
> 
> I'm currently hard-coding my username/password in the repourl, and I'd like
> to move away from that for security reasons. However, even after reading
> the docs and looking at the source, I can see no obvious way to specify the
> pem key file to checkout and fetch via ssh.

On my builder I use ssh_config(5) to provide key material.

Create (or import) the ssh-key for the buildbot-worker user.

Then create a ~/.ssh/config for the buildbot-worker user like this:

```
Host myreposerver
    Hostname my-repo-server.example.com
    User git
    IdentityFile ~/.ssh/id_ed25519
```

As the repository url in the scheduler you can now use e.g. "myreposerver:myproject.git" and ssh will use the IdentityFile to log in.

Several things:
 * Ensure that the SSH host key for your repo server is in ~/.ssh/known_hosts
 * This only works for passphrase-less keys, so use a separate key for the buildbot worker

Best regards,

Pieter

-- 
Pieter Lexis
PowerDNS.COM BV -- https://www.powerdns.com


More information about the users mailing list