Reputation: 518
I have a private gem server protected by http basic authentication. Currently, I'm storing the credentials as environment variables and have this line at the top of my Gemfile:
source "https://#{ENV['GEMS_USERNAME']}:#{ENV['GEMS_PASSWORD']}@gems.myserver.com"
So far so good, and when I run bundle everything seems to work. But than I looked at the generated Gemfile.lock and noticed that the credentials for my server got hardcoded there.
GEM
remote: https://rubygems.org/
remote: https://username:[email protected]/
Is there a way to prevent this from happening? I don't want to push my credentials into the git repo.
Upvotes: 2
Views: 5205
Reputation: 1471
If you are using bundler >= 1.6 you can simply do something like this:
bundle config http://gems.myserver.com username:password
And it should put those credentials in your .bundle/config file so you don't need to explicitly include them on your Gemfile(.lock) anymore.
Upvotes: 3