简体   繁体   中英

Permission Denied (publickey) during cap deploy ever since I moved to bitbucket

I've recently moved my git repo to bitbucket and now i'm unable to deploy my app because i'm getting this error:

 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

I'm using capistrano 3 and here's the part that should forward my ssh options from my deploy file:

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

My public key from my local machine is on bitbucket already and this works:

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

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

Any suggestions?

It seems that the var/www/mysite/repo folder on my server had some git references to my old repo (the non bitbucket one) so I just removed that folder. Voila!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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