从镜像克隆时,npm 不支持 git 的 "insteadOf" 配置

npm doesn't honor git's "insteadOf" config when cloning from mirrors

我已经设置了以下命令来防止 npm 使用 GIT 协议下载 NPM 包,因为它被我的服务器以某种方式阻止了:

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

但是,当 运行 npm install 时,仍然会出现错误,因为在从镜像进行 repo 克隆的上下文中,包试图使用 Git 协议:

npm ERR! git clone --template=/home/jenkins/.npm/_git-remotes/_templates --mirror git://github.com/isaacs/js-yaml.git /home/jenkins/.npm/_git-remotes/git-github-com-isaacs-js-yaml-git-dd3d7a8b: Cloning into bare repository '/home/jenkins/.npm/_git-remotes/git-github-com-isaacs-js-yaml-git-dd3d7a8b'...
npm ERR! git clone --template=/home/jenkins/.npm/_git-remotes/_templates --mirror git://github.com/isaacs/js-yaml.git /home/jenkins/.npm/_git-remotes/git-github-com-isaacs-js-yaml-git-dd3d7a8b: 
npm ERR! git clone --template=/home/jenkins/.npm/_git-remotes/_templates --mirror git://github.com/isaacs/js-yaml.git /home/jenkins/.npm/_git-remotes/git-github-com-isaacs-js-yaml-git-dd3d7a8b: fatal: unable to connect to github.com:
npm ERR! git clone --template=/home/jenkins/.npm/_git-remotes/_templates --mirror git://github.com/isaacs/js-yaml.git /home/jenkins/.npm/_git-remotes/git-github-com-isaacs-js-yaml-git-dd3d7a8b: github.com[0: 192.30.252.129]: errno=Connection refused

我比较了 node_modules 中安装的模块和 package.json 中声明的模块,唯一缺少的是 grunt-contrib-nodeunit,奇怪的是它不依赖于js-yaml... 那么为什么它要克隆它的 repo 呢?无论如何,有没有办法在指定镜像时强制使用 HTTPS?

我可以使用 (git:// 而不是 git@)

来解决这个问题
git config --global url."http://github.com".insteadOf git://github.com