LoginSignup
11
7

More than 5 years have passed since last update.

privateリポジトリに置いたgemをGemfileに含める

Last updated at Posted at 2017-04-05

10年ぶりくらいに記事書きます。
リクエストとか放置ですいません。

内部向けのgemをgithubのプライベートリポジトリで開発して、Gemfileに書いてbundle installする方法はいくつかありますが、環境変数を使い、かつGemfile.lockにtokenを残さないようにするには以下のようにします。

Gemfile
gem 'hoge', git: 'https://github.com/nysalor/private-repo.git'
BUNDLE_GITHUB__COM=[github token]:x-oauth-basic bundle install

tokenはgithubのpersonal access tokenから取得します。

なおGemfileに git: 'git://github.com...'github: 'nysalor/private-repo' と書いてもtokenを利用できないので注意。 git: 'https://github.com...' でないといけない。
考えてみれば当たり前なんだけど、ハマったので。

11
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
7