自从我搬到bitbucket以来,在部署过程中权限被拒绝(publickey)

时间:2014-05-21 02:47:54

标签: ruby-on-rails git ssh capistrano bitbucket

我最近将我的git repo移动到了bitbucket,现在我无法部署我的应用程序,因为我收到了这个错误:

 INFO [5a4fa711] Running /usr/bin/env git remote update on mysite.com
DEBUG [5a4fa711] Command: cd /var/www/mysite/repo && /usr/bin/env git remote update
DEBUG [5a4fa711]        Fetching origin
DEBUG [5a4fa711] 
DEBUG [5a4fa711]        Permission denied (publickey).
DEBUG [5a4fa711] 
DEBUG [5a4fa711]        fatal: The remote end hung up unexpectedly
DEBUG [5a4fa711] 
DEBUG [5a4fa711]        error: Could not fetch origin
...
Tasks: TOP => git:create_release => git:update
(See full trace by running task with --trace)
The deploy has failed with an error: #<SSHKit::Command::Failed: git stdout: Nothing written
git stderr: Nothing written

我正在使用capistrano 3,这是应该从我的部署文件转发我的ssh选项的部分:

set :ssh_options, {
  user: fetch(:user),
  password: fetch(:password),
  keys: %w(~/.ssh/id_rsa),
  forward_agent: true,
  auth_methods: %w(publickey password),
  port: 90
}

我的本​​地计算机上的公钥已经在bitbucket上了,这有效:

$ ssh -T git@bitbucket.org
logged in as myuser.

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

有什么建议吗?

1 个答案:

答案 0 :(得分:1)

我的服务器上的var/www/mysite/repo文件夹似乎有一些git引用我的旧repo(非bitbucket),所以我只删除了该文件夹。瞧!