本文介绍了Capistrano部署与bitbucket - 权限被拒绝(公钥)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ssh -T [email protected] 命令在远程服务器上,并在那里确认?我刚刚检查了部署在Capistrano上的Linux服务器,并且bitbucket.org在部署用户的.ssh / known_hosts文件中列出(它已散列,但> ssh-keygen -F bitbucket.org 显示它)。



Capistrano SSH到远程服务器,并从那里运行git checkout。它需要连接到Bitbucket的权限,虽然通过:forward_agent 选项从源计算机授予访问权。


After adding public key to bitbucket acct, ssh -T [email protected] returns (in windows):

The authenticity of host 'bitbucket.org (131.103.20.167)' can't be established.
RSA key fingerprint is 65:8c:1b:f2:6f:91:6b:5c:3b:ec:4a:46:46:74:7z:40.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'bitbucket.org' (RSA) to the list of known hosts.
logged in as myusername.

You can use git or hg to connect to Bitbucket. Shell access is disabled.

We verified that bitbucket.org has been added to known_hosts. The cap deploy command returns:

Host key verification failed.
fatal: The remote end hung up unexpectedly

We added the following 2 lines to deploy.rb file:

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

Now cap deploy returns error:

 Permission denied (publickey).

Keys are not passphrase protected. If the key is accepted by bitbucket(ssh -T returns right info), why we still have the error of Permission denied.

解决方案

Have you run the ssh -T [email protected] command on the remote server, and confirmed it there? I've just checked a Linux server I deploy onto with Capistrano, and bitbucket.org is listed in the deploying user's .ssh/known_hosts files (it's hashed, but ssh-keygen -F bitbucket.org shows it).

Capistrano SSHes into the remote server, and runs the git checkout from there. It needs permission to connect to Bitbucket, although the access is granted from the source machine, via the :forward_agent option.

这篇关于Capistrano部署与bitbucket - 权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 10:22