diff options
author | ytti <saku@ytti.fi> | 2016-02-25 15:17:28 +0200 |
---|---|---|
committer | ytti <saku@ytti.fi> | 2016-02-25 15:17:28 +0200 |
commit | 9ffa74147da9564ebe9d2f33215bcc1d136cb55b (patch) | |
tree | 53c19a176b526e2d667845d5512a7e4ce11b81b9 | |
parent | 15cab965d14eaa8e8a92f59301cf296d7a62d391 (diff) | |
parent | a4bdbb84b2ecc7dc3499c169a803b90fdb650f98 (diff) |
Merge pull request #343 from awlx/ssh_key_support
Ssh key support
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | lib/oxidized/hook/githubrepo.rb | 9 |
2 files changed, 9 insertions, 2 deletions
@@ -595,6 +595,8 @@ This hook configures the repository `remote` and _push_ the code when the specif * `remote_repo`: the remote repository to be pushed to. * `username`: username for repository auth. * `password`: password for repository auth. + * `pubkey`: publickey for repository auth. + * `privkey`: privatekey for repository auth. When using groups repositories, each group must have its own `remote` in the `remote_repo` config. diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb index 7fc6677..a6c6807 100644 --- a/lib/oxidized/hook/githubrepo.rb +++ b/lib/oxidized/hook/githubrepo.rb @@ -49,8 +49,13 @@ class GithubRepo < Oxidized::Hook log "Using https auth", :debug Rugged::Credentials::UserPassword.new(username: cfg.username, password: cfg.password) else - log "Using ssh auth", :debug - Rugged::Credentials::SshKeyFromAgent.new(username: 'git') + if cfg.has_key?('pubkey') && cfg.has_key?('privkey') + log "Using ssh auth with key", :debug + Rugged::Credentials::SshKey.new(username: 'git', publickey: File.expand_path(cfg.pubkey), privatekey: File.expand_path(cfg.privkey)) + else + log "Using ssh auth with agentforwarding", :debug + Rugged::Credentials::SshKeyFromAgent.new(username: 'git') + end end end |