在机器中使用 Fabric 运行 ssh-add
我正在使用 Fabric 运行一些部署任务,需要将 Mercurial 存储库签出/更新到计算机,然后执行适当的复制/配置。
每次我启动一台新机器(我们目前正在使用 EC2 作为基础设施)或者当我在机器中运行 hg pull
时,它都会询问我的 ssh 密钥密码,这有点烦人我们需要一次初始化十几台机器。
当新的 EC2 实例初始化时,我尝试在 Fabric 中运行 ssh-add
但似乎 ssh-agent
没有为该 shell 运行,我得到来自 Fabric 输出的 无法打开与身份验证代理的连接。
消息。
当通过 Fabric 脚本连接到实例时,如何使 ssh-add 工作?
I'm running some deployment tasks with Fabric that needs to checkout/update a Mercurial repository to the machine and then execute the appropriate copying/configuration.
Every time that I instatiate a new machine (we're currently using EC2 for our infrastructure) or when I run hg pull
in the machine it'll ask for my ssh key passphrase, that's a bit annoying when we need to initialize a dozen machines at a time.
I've tried to run ssh-add
in Fabric when the new EC2 instance is initialized but it seems like that ssh-agent
isn't running for that shell and I get a Could not open a connection to your authentication agent.
message from the output of Fabric.
How would I make ssh-add
work when connected to the instance by the Fabric script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Fabric 问题跟踪器上的评论为我解决了这个问题。它是 的修改版本林肯循环解决方案。使用此“运行”而不是 Fabric 的“运行”将通过本地 ssh 传输您的命令,从而允许您的本地 ssh 代理提供密钥。
请注意,我正在运行 Fabric 1.3.2,并且不再需要此修复。
A comment on fabric's issue tracker solved this for me. It's a modified version of the lincolnloop solution. Using this "run" instead of fabric's will pipe your commands through ssh locally, allowing your local ssh-agent to provide the keys.
Please note that I'm running Fabric 1.3.2, and this fix won't be needed much longer.