简体   繁体   English

Capistrano使用bitbucket部署-权限被拒绝(公钥)

[英]Capistrano deploy with bitbucket - Permission denied (publickey)

After adding public key to bitbucket acct, ssh -T git@bitbucket.org returns (in windows): 将公钥添加到bitbucket acct之后, 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.

We verified that bitbucket.org has been added to known_hosts . 我们验证了bitbucket.org已被添加到known_hosts The cap deploy command returns: cap deploy命令返回:

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

We added the following 2 lines to deploy.rb file: 我们将以下两行添加到deploy.rb文件:

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

Now cap deploy returns error: 现在, cap deploy返回错误:

 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 . 如果密钥被bitbucket接受( ssh -T返回正确的信息),为什么我们仍然会出现Permission denied的错误。

Have you run the ssh -T git@bitbucket.org command on the remote server, and confirmed it there? 您是否已在远程服务器上运行ssh -T git@bitbucket.org命令,并在此确认了该命令? 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部署到的Linux服务器,并且bitbucket.org列在正在部署的用户的.ssh / known_hosts文件中(已散列,但ssh-keygen -F bitbucket.org显示了它)。

Capistrano SSHes into the remote server, and runs the git checkout from there. Capistrano SSH进入远程服务器,然后从那里运行git checkout。 It needs permission to connect to Bitbucket, although the access is granted from the source machine, via the :forward_agent option. 尽管访问是通过:forward_agent选项从源计算机授予的,但它需要连接到Bitbucket的权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM