Thursday, November 7, 2013

Capistrano deploy fails with gem hosted on GitHub.com

A college of mine and I recently upgraded on of our side projects from a Rails 3 and ruby 1.9.3 to Rails 4 and ruby 2.0.  In the course of doing so we needed to ensure that all the dependent GEM's we are using were Rails 4 and ruby 2.0 compatible.   As is usually the case someone had done the leg work and although not all of the core projects were updated, he was able to find forks on the original projects that had done the upgrades.

Today I was finally getting around to making sure the the application could still deploy to our staged environment.  Unfortunately it was failing.  I use Capistrano for the deployment and I was seeing it fail to clone the one of these GitHub hosted, upgraded GEMs my college found.  The error was:

Permission denied (publickey).
fatal: The remote end hungh up unexpectedly
Git error: command `git clone 'git@github.com:tsmango/default_value_for.git'



I immediately tried to clone the project from my terminal window and all worked fine.  I thought, GitHub.com must be having an issue but upon checking that out on the status page they were not reporting any issues at all.  If I had paid more attention to the details all the clues I needed where right there in front of me but the actual problem still didn't dawn on me until I looked up this post.

Turns out the our GEMFILE needed to reference the non-SSH read-only URL for the projects so that I didn't need to authenticate with ssh.

Changed the entry in my GEMFILE from:

gem 'default_value_for', :git => 'git@github.com:tsmango/default_value_for.git'

to:

gem 'default_value_for', :github => 'tsmango/default_value_for'

Once that change was made bundle install was required but then I was able to successfully deploy our application.

Hopefully this saves someone else a few minutes of time troubleshooting similar errors.

No comments:

Post a Comment