我使用 Capistrano v3 和 capistrano/symfony gem 设置了以下部署脚本。我正在使用 Ubuntu 14.4 部署到 AWS EC2 实例
我正在连接从 AWS 下载的 .pem 文件。我的deploy.rb中有以下内容
set :pty, true
set :ssh_options, {
user: 'ubuntu',
keys: ['/Users/myuser/Sites/Myproject.pem'],
forward_agent: true,
auth_methods: ["publickey"]
}
部署时使用
bundle exec cap staging deploy --trace
该脚本连接正常但失败
INFO [4fd1b02c] Running /usr/bin/env git ls-remote --heads [email protected] /cdn-cgi/l/email-protection:MyName/Myproject.git as [email protected] /cdn-cgi/l/email-protection
DEBUG [4fd1b02c] Command: ( SYMFONY_ENV=prod GIT_ASKPASS=/bin/echo GIT_SSH=/var/www/tmp/myproject/git-ssh.sh /usr/bin/env git ls-remote --heads [email protected] /cdn-cgi/l/email-protection:MyName/Myproject.git )
DEBUG [4fd1b02c] Permission denied (publickey).
DEBUG [4fd1b02c]
DEBUG [4fd1b02c] fatal: Could not read from remote repository.
DEBUG [4fd1b02c]
DEBUG [4fd1b02c]
DEBUG [4fd1b02c] Please make sure you have the correct access rights
DEBUG [4fd1b02c]
DEBUG [4fd1b02c] and the repository exists.
DEBUG [4fd1b02c]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as [email protected] /cdn-cgi/l/email-protection: git exit status: 128
git stdout: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
git stderr: Nothing written
我不知道为什么forward_agent不起作用?
我一直在尝试遵循这个指南 -https://developer.github.com/guides/using-ssh-agent-forwarding/#testing-ssh-agent-forwarding https://developer.github.com/guides/using-ssh-agent-forwarding/#testing-ssh-agent-forwarding
但当我谈到这个时
echo "$SSH_AUTH_SOCK"
它打印一个空行。
另外,如果我在服务器上运行它,它会说找不到命令
sshd_config
仔细检查运行 Capistrano 的用户是否已ssh-agent
正在运行并且有ssh-add
编辑了相关的密钥。
以下是一些很好的指南:
https://developer.github.com/guides/using-ssh-agent-forwarding/ https://developer.github.com/guides/using-ssh-agent-forwarding/
http://mah.everybody.org/docs/ssh http://mah.everybody.org/docs/ssh
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)