I have a private gitlab host, which host private codes and project, and I host my app in heroku, in that heroku app, we use Gemfile to manage dependence of that heroku app, one of those dependence is from private gitlab host. so my Gemfile is something like this:
gem 'my_greate_gem', '0.0.1', :git => "http://myprivate_gitlab_host/private_gems/my_great_gem.git"
It's seems there's not any tutorial mentions about using private gitlab host to hosting gem in Heroku, but I really don't want to use gemfury. Is there any possible solution for this?
Without using Gemfury you would have to pass a username and password in the URL of the gem dependency
gem 'my_greate_gem', '0.0.1', :git => "http://<username>:<password>@myprivate_gitlab_host/private_gems/my_great_gem.git"
The other answer didn't work for me. Also, I prefer a method that allows me to keep credentials out of source. I put the following in my gemfile:
gem 'mygem', git: "https://oauth2:#{ENV['GITLAB_TOKEN']}@gitlab.com/mygroup/mygem.git"
The gitlab token I created has API access. This works for me on heroku if I manually set the GITLAB_TOKEN
in the environment variables in settings.
Hope that helps.