Capistrano使用bitbucket进行部署 - 权限被拒绝(publickey)

use*_*363 1 git ssh bitbucket

将公钥添加到bitbucketacct后,ssh -T git@bitbucket.org返回(在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.
Run Code Online (Sandbox Code Playgroud)

我们bitbucket.org已经确认已添加到known_hosts.该cap deploy命令返回:

Host key verification failed.
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

我们在deploy.rb文件中添加了以下两行:

ssh_options[:forward_agent] = true
default_run_options[:pty] = true
Run Code Online (Sandbox Code Playgroud)

现在cap deploy返回错误:

 Permission denied (publickey).
Run Code Online (Sandbox Code Playgroud)

密钥不受密码保护.如果密钥被接受bitbucket(ssh -T返回正确的信息),为什么我们仍然有错误Permission denied.

Ali*_*man 7

您是否ssh -T git@bitbucket.org在远程服务器上运行该命令并在那里确认了?我刚刚使用Capistrano检查了我部署的Linux服务器,并且在部署用户的.ssh/known_hosts文件中列出了bitbucket.org(它已经哈希,但ssh-keygen -F bitbucket.org显示了它).

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