【问题标题】:Installing Atom packages with git port blocked在 git 端口被阻止的情况下安装 Atom 包
【发布时间】:2015-04-18 00:08:56
【问题描述】:

我正在尝试为 atom 安装 autocomplete-clang 插件。不幸的是,我公司的防火墙阻止了 git:// 协议使用的 9418 端口。

我能够安装使用 https:// URL 克隆 git repos 和依赖项的插件,但是当我尝试安装 autocomplete-clang 时,我收到以下错误:

npm WARN `git config --get remote.origin.url` 返回错误结果 (git://github.com/Kev/clang-flags.git) https://github.com/Kev/clang-flags .git
npm 错误! git clone git://github.com/Kev/clang-flags.git 克隆到裸存储库 '~/.atom/.apm/_git-remotes/git-github-com-Kev-clang-flags-git-1a523481' ...
npm 错误! git clone git://github.com/Kev/clang-flags.git 致命:无法连接到 github.com:
npm 错误! git clone git://github.com/Kev/clang-flags.git github.com[0: 192.30.252.130]: errno=Connection timed out
npm 错误! Linux 3.11-2-amd64
npm 错误! argv "/usr/share/atom/resources/app/apm/bin/node" "/usr/share/atom/resources/app/apm/node_modules/npm/bin/npm-cli.js" "--globalconfig" “/home/clement/.atom/.apm/.apmrc” “--userconfig” “/home/clement/.atom/.apmrc” “安装” “/tmp/d-115117-10848-qhdhe7/package.tgz " "--target=0.21.0" "--arch=x64"
npm 错误!节点 v0.10.35
npm 错误! npm v2.3.0
npm 错误!代码 128

npm 错误!命令失败:克隆到裸存储库 '~/.atom/.apm/_git-remotes/git-github-com-Kev-clang-flags-git-1a523481'...
npm 错误!致命:无法连接到 github.com:
npm 错误! github.com[0: 192.30.252.130]: errno=连接超时
npm 错误!
npm 错误!
npm 错误!
npm 错误!如果您需要帮助,可以在以下位置报告此错误:
npm 错误!

npm 错误!请在任何支持请求中包含以下文件:
npm 错误! /tmp/apm-install-dir-115117-10848-1qirptl/npm-debug.log

我尝试将此添加到我的 gitconfig:

[网址“https://”]
    而不是 = git://

我还将流量从端口 9418 重定向到端口 80

# iptables -t nat -L -n -v
链 PREROUTING(策略接受 24948 个数据包,4967K 字节)
 pkts bytes target prot opt in out source destination
    0 0 重定向 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:9418 重定向端口 80

但它不起作用。我错过了什么 ?我怎么能绕过这个块?

【问题讨论】:

    标签: c++ git package atom-editor


    【解决方案1】:

    如果你无法指示 git 始终使用 https 代替 git,请先尝试:

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

    OP Opera 确认in the comments 链接到atom/apm 106 的问题,与npm/npm 5257 相关:

    apm 不尊重git config --global url."https://".insteadOf git://

    Opera 补充:

    我编辑了add-remote-git.js 文件(现在包含atom/apm 106 中引用的代码)并添加了最后一条评论中建议的替换调用。

    【讨论】:

    • 这就是我用来编辑我的 gitconfig 的内容。刚试了一遍,还是不行。
    • @Opera 你用的是什么版本的 Git?
    • $ git --version git 版本 1.8.5.1
    • @Opera 这应该可以工作,除非 Atomio 在内部使用另一个 git(jgit?libgit2?)。该工具中是否有任何 .gitconfig?
    • @Opera 按照github.com/atom/apm/issues/106中的说明查找cache.js
    猜你喜欢
    • 2014-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-09
    • 2022-10-15
    • 2020-06-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多