flybirdtt
flybirdtt

Reputation: 47

Capistrano deploy failed due to repository access denied

I run cap deploy in my desktop and it able to connect to server. But after that it failed to clone code from Bitbucket.

conq: repository access denied. The error like this: (The xxxx just a mask)

failed: "rvm_path=/usr/local/rvm /usr/local/rvm/bin/rvm-shell 'ruby-2.1.3' -c 'if [ -d /var/www/staging.xxxx.com/shared/cached-copy ]; then cd /var/www/staging.xxxx.com/shared/cached-copy && git fetch origin && git fetch --tags origin && git reset --hard 0e878ca6da018bff824d1f4d9e9d7a8805f1ce1b && git clean -d -x -f; else git clone [email protected]:xxxx-admin/xxxx.git /var/www/staging.xxxx.com/shared/cached-copy && cd /var/www/staging.xxxx.com/shared/cached-copy && git checkout -b deploy 0e878ca6da018bff824d1f4d9e9d7a8805f1ce1b; fi'" on 13x.xxx.xxx.xx5

I tied to login to the server and run git clone directly. Server is able to access the bitbucket repository and can clone the code.

Please help.

Thank you very much.

Upvotes: 0

Views: 956

Answers (1)

Jim Redmond
Jim Redmond

Reputation: 5660

"conq: repository access denied" implies one of two things:

  1. Capistrano isn't using the correct SSH key for that repository.
  2. Capistrano isn't using an SSH key at all.

Try running ssh -v -i /path/to/key [email protected] as Capistrano and using the private key Capistrano is supposed to use. If that fails, then you've got the wrong key; if it succeeds, then you may need to start the ssh-agent daemon before your deploy (http://spin.atomicobject.com/2013/03/23/capistrano-deploys-ssh-agent/).

Upvotes: 2

Related Questions