Force bundle install to use https:// instead of git:// for GitHub-based gems

Bell picture Bell · Jan 21, 2014 · Viewed 12.7k times · Source

I am trying to build a rails project and because the host I am working on doesn't have access to the Internet for the the git:// protocol (port 9418) I get errors like

Fetching git://github.com/pivotal/jasmine.git
fatal: unable to connect to github.com:
github.com[0: 192.30.252.130]: errno=Connection refused

when running bundle install.

The relevant line in the GemFile doesn't specify git:// as a protocol, it just points to GitHub as the source for the gem

gem 'jasmine', :github => 'pivotal/jasmine-gem'

What do I have to do to make bundler to use https:// rather than git:// for pulling gems from GitHub?

Edit:

Is there a way other than editing every affected line in the GemFile? I'd prefer to avoid any merging issues down the line if the project's GemFile is updated.

Answer

Sam Kah Chiin picture Sam Kah Chiin · Dec 29, 2016

Use bundle config github.https true