在r10k.yaml中设置private_key不起作用

时间:2017-06-30 11:05:29

标签: git ssh puppet private-key

我的r10k.yaml配置如下:

gzip

我以root身份运行(暂时):

request({
  method : 'GET',
  uri    : ItemURL,   
  gzip   : true, 
}).pipe(writeStream)

sshv2.sh包含:

:cachedir: /var/cache/r10k
:sources:
  github:
    basedir: /etc/puppet/environments
    prefix: false
    remote: ssh://git@git.server:port/owner/repo.git
:git:
  private_key: '/root/.ssh/bitbucket.nopassphrase'

我得到了:

GIT_TRACE=1 GIT_SSH='~/sshv2.sh' r10k deploy environment env -v

为什么不尝试使用r10k.yaml中提供的密钥文件?

我有:

#!/bin/bash
ssh -v $*

Faraday: you may want to install system_timer for reliable timeouts
ERROR    -> Unable to determine current branches for Git source 'github' (/etc/puppet/environments)
Original exception:
Command exited with non-zero exit code:
Command: git --git-dir /var/cache/r10k/ssh---git@git.server-port-owner-repo.git fetch --prune
Stderr:
trace: built-in: git 'fetch' '--prune'
trace: run_command: '~/sshv2.sh' '-p' 'port' 'git@git.server' 'git-upload-pack '\''/owner/repo.git'\'''
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to git.server [<IP>] port <port>.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/identity-cert type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version SSHD-UNKNOWN
debug1: no match: SSHD-UNKNOWN
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '[server.name]:port' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: No more authentication methods to try.
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Exit code: 128

我做错了什么还是我的r10k或git太老了?

1 个答案:

答案 0 :(得分:0)

private_key设置仅由坚固的提供程序使用,而不是由默认的 shellgit 提供程序使用,因此您的脚本可以使用备用私钥,但r10k没有。

github上的r10k.yaml example包含有关每个设置的更多信息。