Question

My capistrano script cannot connect to my github private repository.

here is some of my deploy.rb file:

set :scm, :git
set :repository,  "git@github.com:ohenrik/imagesite.git"
set :ssh_options, { :forward_agent => true }

set :deploy_to, "/home/rails/apps/#{application}"

I have tested agent forwariding on my server and it seems to be working (i can get authorised by github without password or other ssh keys installed).

I think I have the right repository address now, but I'm not sure.

Edit, I get this output:

Oles-MacBook-Pro:imagesite ohenrik$ cap production deploy
    triggering load callbacks
  * 2014-03-29 21:48:42 executing `production'
    triggering start callbacks for `deploy'
  * 2014-03-29 21:48:42 executing `multistage:ensure'
  * 2014-03-29 21:48:42 executing `deploy'
  * 2014-03-29 21:48:42 executing `deploy:update'
 ** transaction: start
  * 2014-03-29 21:48:42 executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote git@github.com:ohenrik/imagesite.git master"
    command finished in 4123ms
  * executing "if [ -d /home/rails/apps/imagesite/shared/cached-copy ]; then cd /home/rails/apps/imagesite/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard ce911e1e458b98ba001a2f5a919e3414817e833e && git clean -q -d -x -f; else git clone -q -b master git@github.com:ohenrik/imagesite.git /home/rails/apps/imagesite/shared/cached-copy && cd /home/rails/apps/imagesite/shared/cached-copy && git checkout -q -b deploy ce911e1e458b98ba001a2f5a919e3414817e833e; fi"
    servers: ["theatrical.co"]
    [theatrical.co] executing command
 ** [theatrical.co :: out] Username for 'https://github.com':

The scrip hangs on the last line.

Was it helpful?

Solution

Try clearing out the old cached copy -- if you changed the git repository in deploy.rb, Capistrano doesn't automatically update the repository in the cached copy on the server.

$ ssh {production server}
$ rm -rf /home/rails/apps/imagesite/shared/cached-copy
$ exit
$ cap production deploy
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top