Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Use shorthand instead of full Github repository URIs in your Gemfile.

Oh, yes... syntactic sugars!


gem install bundler-github

Note: Currently, this gem must always be installed after Bundler. If you update or re-install Bundler, you'll need to re-install this gem. See the caveat below for details.


In your Gemfile you can now replace:

gem 'recaptcha', git: ''


gem 'recaptcha', github: 'ambethia/recaptcha'

But wait! That sugar only gets sweeter! If the repository's name is the same as the gem's name (and it usally is), you can leave out the repo name and just include the repository owner.

gem 'recaptcha', github: 'ambethia'

How you like them apples!?

One inconvenience I haven't figured a work around for is that you'll need to explicitly require bundler/github before you require bundler/setup. In a Rails app you might change your boot.rb (oh, the humanity!) from:

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

to look like:

if File.exists?(ENV['BUNDLE_GEMFILE'])
  require 'bundler/github'
  require 'bundler/setup'

However, you don't need to require bundler-github from your Gemfile, it's already loaded by the time your application's Gemfile is read anyways.

Private Repositories

By default HTTP transport is used, but you can switch to an authenticated url scheme (ssh) by prepending a : to the account name, like:

gem 'has_secrets', github: ':ambethia'

Other notes on usage

  • bundler-github just catches and replaces the :github option with :git after expanding the URI, other options, like :branch, :ref, etc. will be left untouched. Also, any gems that just use :git don't altered either.
  • I may favor the Ruby 1.9 syntaxes in my examples, but the gem does not. It was developed for and tested against 1.8.7 and 1.9.x.

Caveat emptor!

You coveteth my ice cream bar...

I have no idea if this is going to work for you, in your environment. It's beta-quality software, and as such should not be considered production ready.

The only way I could find to hook in and add the :github option was to make my own bundle command which replaces the executable generated by Rubygems in your $PATH. The new command includes our patch then loads Bunder's original bundle command. For a hack, I think it's pretty elegant.

The unique way bundler is used makes it challenging to extend without any kind of plugin API. If you can suggest a better way to hook it without needing to modify the original gem, I'd love to hear it.


Copyright © 2011 Jason L Perry. See MIT-LICENSE for the rights reserved.

You can’t perform that action at this time.