会社でbundle installやgit cloneしたときに
git clone git://github.com/creationix/nvm.git ~/nvm Initialized empty Git repository in /home/xxxx/nvm/.git/ github.com[0: 207.97.227.239]: errno=Connection timed out fatal: unable to connect a socket (Connection timed out)
GitHub Connection Timed Out
みたいなのが出ました。
git cloneだとプロトコル変えればいいんだけど、
bundlerだとGemfileを修正するのはちょっと面倒。
gitプロトコル(9418)をfirewall開けて欲しいけど、
手続き面倒なのでなんか自動でhttpsに置換する方法がきっとあるんだろうと
思って調べてみました。
対策1 gitの設定で回避する
github - git:// protocol blocked by company, how can I get around that? - Stack Overflow
git config --global url."https://".insteadOf git://
or
~/.gitconfig:
[url "https://"] insteadOf = git://
そうそう、こんなの期待してました。
多分これで解決しそう。(まだ試してない)
これで問題なく解決しました!
対策2 hubコマンドの設定で回避する
# default behavior $ git clone defunkt/repl < git clone > # opt into HTTPS: $ git config --global hub.protocol https $ git clone defunkt/repl < https clone >
これもやり方は同じようなもんでしょうが
対策1がダメだったらhubコマンドでやってみます。