Configure Bundler for Access to Private Repositories

What worked for me is using ENV VARs:

gem 'iron_warbler', :git => "https://piousbox:#{ENV['GITHUB_TOKEN']}@github.com/wasyaco/iron_warbler.git", :branch => '0.1.0'

What didn't but should have worked is reproduced below: You can add authentication information to it like this:

$ bundle config GITHUB__COM username:password
$ bundle config --local GITHUB__COM username:password

Bundler actually allows all config options to also be set via environment variables:

$ export BUNDLE_GITHUB__COM=username:password
                        

Or if you’re using personal access tokens

$ export BUNDLE_GITHUB__COM=x-access-token:<token>
                

This technique works really well with Travis and Heroku, since they allow environment variables to be stored securely. Note: You can set env vars for deploy user in /etc/environment .

Please login to post a comment.