我正在尝试将我的Rails应用程序从Bitbucket部署到Digital Ocean。 我使用Git作为版本控制系统,我已完成以下操作:
这是我的
如果我将存储库克隆到本地,它可以正常工作。我查看了Bitbucket文档,但仍然无法确定缺少什么。我的ssh到Bitbucket也可以正常工作。
- 获取本地计算机的ssh密钥:
pbcopy < ~/.ssh/id_rsa.pub
- 将本地计算机的ssh密钥添加到Digital Ocean中(https://cloud.digitalocean.com/ssh_keys)
- 将本地计算机的ssh密钥添加到Bitbucket仓库作为部署密钥(
https://bitbucket.org/<account name>/<project admin/deploy-keys
)
cap deploy
时会出现以下错误: servers: [<server ip>]
[<server ip>] executing command
** [<server ip> :: out] Permission denied (publickey).
** [<server ip> :: out]
** [<server ip> :: out] fatal: Could not read from remote repository.
** [<server ip> :: out]
** [<server ip> :: out]
** [<server ip> :: out] Please make sure you have the correct access rights
** [<server ip> :: out]
** [<server ip> :: out] and the repository exists.
** [<server ip> :: out]
这是我的
deploy.rb
文件。set :scm, "git"
set :repository, "git@bitbucket.org:<user name>/<project name>.git"
set :branch, "master"
如果我将存储库克隆到本地,它可以正常工作。我查看了Bitbucket文档,但仍然无法确定缺少什么。我的ssh到Bitbucket也可以正常工作。
ssh -T git@bitbucket.org
authenticated via a deploy key.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
This deploy key has read access to the following repositories:
<repor name>
我找到这个SO问题,但是没有成功解决。