Github 如何使用saltstack和capistrano使minion连接到git存储库

Github 如何使用saltstack和capistrano使minion连接到git存储库,github,amazon-ec2,capistrano,salt-stack,Github,Amazon Ec2,Capistrano,Salt Stack,我正在尝试使用saltstack和capistrano在ec2上创建运行rails应用程序 以下是我迄今为止成功完成的工作。 使用saltcloud和saltmaster,我能够创建一个新的minion实例,并设置应用程序运行所需的一切,如ruby、rails、unicorn、mysql等 我已经为capistrano做了正确的配置。当我尝试部署时,我看到以下错误 DEBUG [ed84c6ab] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/pathto/

我正在尝试使用saltstack和capistrano在ec2上创建运行rails应用程序

以下是我迄今为止成功完成的工作。 使用saltcloud和saltmaster,我能够创建一个新的minion实例,并设置应用程序运行所需的一切,如ruby、rails、unicorn、mysql等

我已经为capistrano做了正确的配置。当我尝试部署时,我看到以下错误

DEBUG [ed84c6ab] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/pathto/git-ssh.sh /usr/bin/env git ls-remote -h git@github.com:somehost/somerepo.git )
DEBUG [ed84c6ab]    Warning: Permanently added 'github.com,ip' (RSA) to the list of known hosts.
DEBUG [ed84c6ab]    Permission denied (publickey).
DEBUG [ed84c6ab]    fatal: Could not read from remote repository.
DEBUG [ed84c6ab]
DEBUG [ed84c6ab]    Please make sure you have the correct access rights
DEBUG [ed84c6ab]    and the repository exists.
DEBUG [ed84c6ab] Finished in 12.600 seconds with exit status 128 (failed).
这意味着,从我的本地capistrano可以连接到仆从,但当它尝试签出git repo时,它失败了

我知道这是因为minion的ssh公钥没有添加到github中

所以目标是。 运行saltcloud创建实例 运行salt highstate安装应用程序所需的所有内容 运行capistrano deploy以启动应用程序

我也想自动化github授权过程。我的意思是,一旦创建了仆从,仆从就应该能够克隆git repo,而无需任何手动干预


我不知道这可以通过capistrano或saltstack实现。

我使用github ssh转发来实现这一点。 这是我做的改变

为github启用的步骤

然后在capistrano deploy.rb文件中,通过添加
forward\u agent:true

set :ssh_options, {
 user: 'user',
 auth_methods: %w(publickey),
 port: <some port>,
 forward_agent: true
}
set:ssh\u选项{
用户:“用户”,
验证方法:%w(公钥),
端口:,
转发代理:对
}

把一个已知的ssh密钥推给仆从怎么样?这可以通过saltstack完成。或者,您可以创建一个“新的个人访问令牌”,并使用它通过http进行基本身份验证:那么您的意思是“我的本地”或“主机”上的私钥(其公钥在github上可用)可以复制到其他计算机?复制您的SSH密钥是一个可能的选项。另一个带有个人访问令牌和HTTP基本身份验证的选项将为您提供细粒度的访问控制,以控制您的仆从或主人可以做什么(即github repo的只读访问)。如果您不希望其他仆从访问这些信息,那么所有这些信息都应该安全地存储在支柱中。