Capistrano deploy with bitbucket - Permission denied (publickey)

两盒软妹~` 提交于 2020-01-03 03:31:13

问题


After adding public key to bitbucket acct, ssh -T git@bitbucket.org 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.


回答1:


Have you run the ssh -T git@bitbucket.org 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.



来源:https://stackoverflow.com/questions/30782622/capistrano-deploy-with-bitbucket-permission-denied-publickey

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!