![](/img/trans.png)
[英]Capistrano asks for SSH password when deploying from local machine to server
[英]Capistrano 3 asks for SSH user's password since `do-release-upgrade` was done on Ubuntu 20.04 server
我有一个 Rails 应用程序,到目前为止我可以使用 capistrano 3 成功部署到我的 Ubuntu 服务器。
昨晚我使用do-release-upgrade
成功更新了服务器:
Linux my-server 5.15.0-47-generic #51-Ubuntu SMP Thu Aug 11 07:51:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
我仍然可以使用我的 Mac 终端中的id_rsa
密钥ssh
进入服务器:
ssh user@my-server.example.com
Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-47-generic x86_64)
然而 Capistrano 现在要求输入密码,而不是要求我输入id_rsa
证书的密码:
cap production deploy
user@my-server.example.com's password:
我也尝试运行ssh-copy-id
以确保重新上传证书:
ssh-copy-id user@my-server.example.com
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
(if you think this is a mistake, you may want to use -f option)
这一切都很奇怪,因为就在昨天我确实做了几个部署:
ls -lia rails/releases/ | grep 20220913 | wc -l
9
我根本没有启用 SSH 访问的密码,所以我想知道如何重新启用 SSH 与我的服务器的通信。
该问题可能与“SSH 代理转发”有关。 我确实使用了capistrano-ssh-doctor
,它告诉我:
SSH 代理转发报告
[成功]
repo_url
设置成功[成功] ssh 私钥文件存在
[成功]
ssh-agent
进程似乎在本地运行[成功] ssh
ssh-add
ssh-agent
进程[成功] ssh 私钥添加到
ssh-agent
[成功] 可从本地计算机访问的应用程序存储库
[成功] 所有主机使用无密码登录
[成功] 所有主机都可以使用
forward_agent
[成功] ssh 代理成功转发到远程主机
[错误] Capistrano 似乎无法从这些主机访问应用程序 git 存储库:my-server.example.com 操作:
- 确保所有先前的检查都通过。 这也应该使这个工作。
似乎 SSH 代理转发设置不正确。 按照错误消息中描述的建议步骤进行操作。 错误(如果不止一个)按重要性排序,所以总是从第一个开始。
因此,我登录了服务器,并且能够成功克隆存储库。
这篇文章中有一些信息:
I'd still like to find out why I can't use the
git@github.com:{github-organization}/{private-repo}.git
format for:repo_url
, with keys, when all of the SSH forwarding report's requirements似乎遇到了。 如果您需要我提供更多信息,请告诉我 - 再次感谢您的帮助!
所以似乎需要更改:repo_url
。 我会试一试。
我确实发现现在由于某种原因以下命令不再起作用:
cap staging deploy
相反,我需要使用捆绑器
bundle exec cap staging deploy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.