I want to use a hosted private gem on my Ruby project. This gem is hosted on GitLab.
So I need help on what to add in my Ruby Gemfile to "import" this privately hosted gem.
I am able to use private gems from GitHub or Gemfury but need help with GitLab.
To use a private hosted gem on gitlab you need to create an access token it should have api access. Then after you set in your ENV you can add the following to your gemfile:
gem 'mygem', git: "https://oauth2:#{ENV['GITLAB_TOKEN']}@gitlab.com/mygroup/mygem.git"
I would not put my gitlab username and password in my gemfile because then they exist in your source code for everyone whom has access to see them. It is important to note that your oauth token will be printed in your Gemfile.lock if you use this method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With