Capistrano 3部署失败连接到GitHub - 权限被拒绝(公钥)
我有以下部署脚本与Capistrano v3和capistrano/symfony创业板设置。我正在使用Ubuntu 14.4 部署到AWS EC2实例我正在连接从AWS下载的.pem文件。与Capistrano 3部署失败连接到GitHub - 权限被拒绝(公钥)
bundle exec cap staging deploy --trace
的脚本连接正常,但无法在这个
INFO [4fd1b02c] Running /usr/bin/env git ls-remote --heads [email protected]:MyName/Myproject.git as [email protected]
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]: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]: 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是不是当我deploy.rb
set :pty, true
set :ssh_options, {
user: 'ubuntu',
keys: ['/Users/myuser/Sites/Myproject.pem'],
forward_agent: true,
auth_methods: ["publickey"]
}
我有以下加工?
我一直在试图按照本指南 - https://developer.github.com/guides/using-ssh-agent-forwarding/#testing-ssh-agent-forwarding
但是当我得到这个
echo "$SSH_AUTH_SOCK"
它打印一个空行。
另外,如果我在服务器上运行这一点,说没有发现
sshd_config
命令仔细检查运行Capistrano的用户有ssh-agent
运行,并且有ssh-add
ED相关的关键。
这里有一些很好的指南:
https://developer.github.com/guides/using-ssh-agent-forwarding/
我的问题的解决方案是两件事情。首先,我不得不转发我id_rsa在这样的脚本:
set :ssh_options, {
user: 'ubuntu',
keys: ['~/.ssh/id_rsa'],
forward_agent: true,
auth_methods: ["publickey"]
}
我把我的id_rsa.pub密钥的服务器上,这样我可以ssh到使用相同的密钥服务器,因为我被转发。
我所要做的就是设置使用/ tmp目录的权限
chmod 1777 /tmp
我已经帽运行“$ bundle exec cap test deploy
”
Error :
git stdout: Nothing written
git stderr: Warning: Permanently added the RSA host key for IP address 'xxxxxxxxx' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
中面临类似的问题,在这个场景中的第二件事情,我们需要使用ssh密钥验证github帐户
导航到github - >设置 - > SSH和GPG密钥(部分) - >添加“新SSh密钥”,复制您的公共键($ ssh-keygen #generate new key
))并粘贴按键输入字段。一旦添加密钥,使用此命令“$ ssh -T [email protected]
”检查身份验证。它会显示以下输出
Hi <xxxxxxxx>! You've successfully authenticated, but GitHub does not provide shell access.
现在它工作正常!
我现在在部署过程中出现了其他失败的消息,我提出了一个新的问题 - http:// stackoverflow。com/questions/33128623/capistrano-3-deploy-failed-messages-exit-status-1-failed – Patrick