gitプロトコルをhttpsに固定して接続する(社内環境で便利)



gitに接続する時に下記のエラーが出る時の対処法

$ git clone git://github.com/xxx/xxx.git
fatal: unable to connect to github.com:
github.com[0: 192.30.252.130]: errno=Operation timed out

社内環境のファイアーウォールでgitプロトコルが許可されてない場合など、このエラーが発生します。
gitプロトコルを利用するとエラーが発生してしまうので、httpsを利用して接続するようgit configを設定します。

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

または、.gitconfigに直接指定もできます。

~/.gitconfig

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