Gotcha when deploying to heroku with a forked gem
22 May 2015
So we were deploying to heroku and we have a gem as part of project thats forked from original and heroku didnt like it at all and we got an error like so
Removing .DS_Store files
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.0.0
remote: -----> Installing dependencies using 1.9.7
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Fetching gem metadata from https://rubygems.org/.............
remote: Fetching version metadata from https://rubygems.org/...
remote: Fetching dependency metadata from https://rubygems.org/..
remote: Fetching git@github.com:siassaj/acts_as_follower.git
remote: Host key verification failed.
remote: fatal: Could not read from remote repository.
remote: Please make sure you have the correct access rights
remote: and the repository exists.
remote: Retrying git clone 'git@github.com:siassaj/acts_as_follower.git' "/tmp/build_aab7506f5342f75413d3d85d01e2a558/vendor/bundle/ruby/2.0.0/cache/bundler/git/acts_as_follower-5ebd9d15f4ab98d51b4735c6146a547d602764cb" --bare --no-hardlinks --quiet due to error (2/3): Bundler::Source::Git::GitCommandError Git error: command `git clone 'git@github.com:siassaj/acts_as_follower.git' "/tmp/build_aab7506f5342f75413d3d85d01e2a558/vendor/bundle/ruby/2.0.0/cache/bundler/git/acts_as_follower-5ebd9d15f4ab98d51b4735c6146a547d602764cb" --bare --no-hardlinks --quiet` in directory /tmp/build_aab7506f5342f75413d3d85d01e2a558 has failed.
In our gem file we had
gem 'acts_as_follower', git: "git@github.com:siassaj/acts_as_follower.git"
Now this left us scratching our heads as haven't seen this issue before. After some reading we found the issue
The git@github.com:… URL is the writable SSH version, which requires authentication with an SSH key connected to a GitHub account that has write access to the repository.
The git://github.com/… URL is the public, read-only version.
Since the gem you're using is in a public GitHub repository, you can also use this shorthand in your Gemfile:
So we changed our gem to to below and all good again in the world of development
gem 'acts_as_follower', github: "siassaj/acts_as_follower"