Installing a gem from a private GitHub repo (Heroku)

frodsan
frodsan
Feb 29, 2016 · 2 min read

0. Getting started

$ bundle --version Bundler version 1.11.2

1. Get your OAuth Token from GitHub

2. Setting up your credentials

$ bundle config GITHUB__COM myoauthtoken:x-oauth-basic
$ bundle config --local GITHUB__COM myoauthtoken:x-oauth-basic

3. Install your dependencies

gem "mygem", git: "https://github.com/user/mygem.git"
$ bundle install
Fetching https://github.com/user/mygem.git
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Using mygem 1.0.0 from https://github.com/user/mygem.git (at master@bc4adfb)
Using bundler 1.11.2
Bundle complete! 1 Gemfile dependency, 2 gems now installed.

4. Setting up Heroku

$ heroku buildpacks:remove heroku/ruby 
$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-ruby
$ heroku config:add BUNDLE_GITHUB__COM=myoauthtoken:x-oauth-basic
$ git push heroku master
# ...
remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote: Using bundler 1.11.2
remote: Using mygem 1.0.0 from https://github.com/user/mygem.git (at master@bc4adfb)
remote: Bundle complete! 1 Gemfile dependency, 2 gems now installed.

frodsan

Written by

frodsan

Developer at Vipps (https://www.vipps.no)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade