使用git端口阻止安装Atom软件包

时间:2015-02-17 09:52:31

标签: c++ git package atom-editor

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

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

npm WARN `git config --get remote.origin.url` returned wrong result (git://github.com/Kev/clang-flags.git) https://github.com/Kev/clang-flags.git
npm ERR! git clone git://github.com/Kev/clang-flags.git Cloning into bare repository '~/.atom/.apm/_git-remotes/git-github-com-Kev-clang-flags-git-1a523481'...
npm ERR! git clone git://github.com/Kev/clang-flags.git fatal: unable to connect to github.com:
npm ERR! git clone git://github.com/Kev/clang-flags.git github.com[0: 192.30.252.130]: errno=Connection timed out
npm ERR! Linux 3.11-2-amd64
npm ERR! 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" "install" "/tmp/d-115117-10848-qhdhe7/package.tgz" "--target=0.21.0" "--arch=x64"
npm ERR! node v0.10.35
npm ERR! npm  v2.3.0
npm ERR! code 128

npm ERR! Command failed: Cloning into bare repository '~/.atom/.apm/_git-remotes/git-github-com-Kev-clang-flags-git-1a523481'...
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 192.30.252.130]: errno=Connection timed out
npm ERR! 
npm ERR! 
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     

npm ERR! Please include the following file with any support request:
npm ERR!     /tmp/apm-install-dir-115117-10848-1qirptl/npm-debug.log

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

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

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

# iptables -t nat -L -n -v
Chain PREROUTING (policy ACCEPT 24948 packets, 4967K bytes)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 REDIRECT   tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:9418 redir ports 80

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

1 个答案:

答案 0 :(得分:1)

如果您不能指示git始终使用https而不是git,请先尝试:

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

OP Opera确认in the commentsatom/apm 106相关的问题与npm/npm 5257相关联:

  

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

Opera补充道:

  

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