强制捆绑安装使用https://而不是git://用于基于GitHub的gem [英] Force bundle install to use https:// instead of git:// for GitHub-based gems

查看:1025
本文介绍了强制捆绑安装使用https://而不是git://用于基于GitHub的gem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个rails项目,并且因为我正在使用的主机无法访问互联网,因此无法访问git://协议(端口9418),我收到了错误信息,如

 获取git://github.com/pivotal/jasmine.git 
致命:无法连接到github.com:
github .com [0:192.30.252.130]:errno =拒绝连接

运行 bundle install 。



GemFile中的相关行没有指定git://作为协议,它只是指向GitHub宝石的来源

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

如何使bundler使用https:/ /而不是git://从GitHub中抽取宝石?



编辑:

有没有其他方法比编辑GemFile中的每一个受影响的行?如果项目的GemFile已更新,我宁愿避免任何合并问题。

解决方案

Git提供使用URL重写功能url.insteadOf配置选项。

因此,要使所有连接到github.com使用https://而不是git://

  git config --global url。https://github.com.insteadOf git://github.com 

$ b

- global 开关为当前所有git操作设置配置选项用户,所以有时候它可能太侵入。但它确实避免了改变当前项目中的git配置。


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.

解决方案

Git provides URL rewriting functionality using the url..insteadOf configuration option.

So to make all connections to github.com use https:// rather than git://

git config --global url."https://github.com".insteadOf git://github.com

The --global switch sets the config option for all git operations by the current user, so there are times where it may be too intrusive. But it does avoid changing the git config in the current project.

这篇关于强制捆绑安装使用https://而不是git://用于基于GitHub的gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆