git被阻止,如何安装npm模块 [英] git is blocked, how to install npm modules

查看:611
本文介绍了git被阻止,如何安装npm模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们通过代理连接, git被阻止(不是网站,而是git //:),我们尝试了egit,git on windows,有和没有代理,但没有一个克隆到本地发生。

现在问题是安装npm模块,我尝试从git网站(通过web)下载模块(zip)并尝试使用本地安装,其中工作,但这里的问题是大量的依赖关系,逐个拉取模块以填充依赖关系(和内部依赖关系)并不容易。



所以如何解决这个问题,我觉得有三种方法可以找到解决方案:


  • 允许通过防火墙的git隧道(我在n / w团队中没有朋友)。
  • 建议我在执行npm install时通过http://(而不是git://)将模块依赖关系提取出来。 使用git网站模块下载完整的依赖关系,案

从这个答案复制
https://stackoverflow.com/a/10729634/1095114





如果这是您的防火墙阻止git:protocol port(9418)的问题,那么您应该做一个更持久的改变,所以你不必记得发出其他职位建议每个git仓库的命令。这也适用于可能使用 git:// 协议的子模块。



只需发出以下命令:



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



这简单地将以下两行添加到〜/ .gitconfig:

[url https://]
insteadOf = git://



现在,所有的git命令都会执行 git:// 替换为 https://


We are connected through a proxy and here, git is blocked ( not the website but on git//: ) we tried with egit, "git on windows", with and without proxy but not a single clone to local happened.

Now the problem is to install npm modules, I tried by downloading modules(zip) from git website (over web) and tried the local install, which worked but the problem here is huge number of dependencies, it is not easy to pull modules one by one to fill dependencies (and inner dependencies).

So how to solve this problem, I feel there can be three ways to find solution:

  • Allowing git tunneling through firewall (i have no friends in n/w team ).
  • Suggest me some way to pull modules with dependencies over http:// (and not git://) when doing npm install.
  • Download from git website modules + full dependencies, in single shot.

解决方案

Copied from this answer https://stackoverflow.com/a/10729634/1095114


If this is an issue with your firewall blocking the git: protocol port (9418), then you should make a more persistent change so you don't have to remember to issue commands suggested by other posts for every git repo. This also just works for submodules that might be using the git:// protocol too.

Simply issue the following command:

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

This simply adds the following two lines to ~/.gitconfig:

[url "https://"] insteadOf = git://

Now, as if by magic, all git commands will perform a substitution of git:// to https://

这篇关于git被阻止,如何安装npm模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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