Capistrano 部署 ** 主机密钥验证失败

发布于 2024-12-11 12:42:49 字数 412 浏览 0 评论 0原文

我遵循了其他网站的一些建议,但没有效果。当我尝试时 cap 部署:冷 我始终收到“主机密钥验证失败”的信息。

我已经尝试了一切。我已经从我的计算机 ssh 到远程,从已知主机中删除并读取了两个密钥,从 github 克隆,从服务器和 github 上的本地设置了我的公钥。

我在这里缺少什么?


上限文件: https://gist.github.com/1308243


错误: https://gist.github.com/1308255

I've followed several suggestions from other sites but to no avail. When I try
cap deploy:cold
I consistently get "Host key verification failed."

I've tried everything. I've ssh'd from my computer to the remote, removed and readded both keys from known-hosts, cloned from github, set up my public key from both the server and local on github.

What am I missing here?


Capfile:
https://gist.github.com/1308243


Errors:
https://gist.github.com/1308255

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

七堇年 2024-12-18 12:42:49

添加到您的deploy.rb:

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

或者登录到您要部署到的服务器(作为您的部署用户)并运行:

ssh [email protected]
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is **:**:**:.
Are you sure you want to continue connecting (yes/no)? yes

大多数时候我看到这个问题是当 github.com 不在您的 中时~ /.ssh/known_hosts

Add to your deploy.rb:

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

Or log in to the server(s) you are deploying to (as your deploy user) and run:

ssh [email protected]
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is **:**:**:.
Are you sure you want to continue connecting (yes/no)? yes

Most of the time I see this issue is when github.com in not in your ~/.ssh/known_hosts

九八野马 2024-12-18 12:42:49

而不是使用看起来像这样的 git ssh url
[email protected]:definelabs/urbanairship.git

使用只读 url看起来像这样
git://github.com/definelabs/urbanairship.git

Instead of using a git ssh url which looks like this
[email protected]:definelabs/urbanairship.git

use a read only url which looks like this
git://github.com/definelabs/urbanairship.git

眉黛浅 2024-12-18 12:42:49

您曾提到 cap deploy:setup 有效,但 cap deploy 失败。所以看起来错误消息与 ssh 连接无关,而与 git checkout 有关。这可能是因为您的 git 远程服务器使用基于密钥的身份验证,并且服务器中缺少所需的密钥。

You had mentioned that cap deploy:setup worked and cap deploy failed. So looks like the error message is not related to the ssh connectivity, and its related to git checkout. It might be because that your git remote server works with key based authentication and the required key is missing in the server.

天气好吗我好吗 2024-12-18 12:42:49

除此之外,

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

我还需要执行这个,如下:

def add_domain_to_known_hosts(hostname)
  ip_address = "`dig +short A #{hostname}`"
  run "ssh-keygen -R #{hostname}"
  run "ssh-keygen -R #{ip_address}"
  run "ssh-keygen -R #{hostname},#{ip_address}"
  run "ssh-keyscan -H #{hostname},#{ip_address} >> ~/.ssh/known_hosts"
  run "ssh-keyscan -H #{ip_address} >> ~/.ssh/known_hosts"
  run "ssh-keyscan -H #{hostname} >> ~/.ssh/known_hosts"
end

尽管如此,应该注意的是 Capistrano 不鼓励 PTY:
https://github.com/capistrano/capistrano#a-word-about- ptys

In addition to

ssh_options[:forward_agent] = true
default_run_options[:pty] = true

I also needed do this, with below:

def add_domain_to_known_hosts(hostname)
  ip_address = "`dig +short A #{hostname}`"
  run "ssh-keygen -R #{hostname}"
  run "ssh-keygen -R #{ip_address}"
  run "ssh-keygen -R #{hostname},#{ip_address}"
  run "ssh-keyscan -H #{hostname},#{ip_address} >> ~/.ssh/known_hosts"
  run "ssh-keyscan -H #{ip_address} >> ~/.ssh/known_hosts"
  run "ssh-keyscan -H #{hostname} >> ~/.ssh/known_hosts"
end

Although, it should be noted that PTY's are discouraged by capistrano:
https://github.com/capistrano/capistrano#a-word-about-ptys

纸短情长 2024-12-18 12:42:49

一个与服务器上的 ~/YOUR_USER_NAME /.ssh/authorized_keys2 相关的文件。我相信它应该包含公钥/私钥(两者之一,我认为是私钥?)

One file to get concerned with ~/YOUR_USER_NAME /.ssh/authorized_keys2 on the server. I believe it should contain the public/private key (one of the two, I think private?)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文