LoginSignup
67
66

More than 5 years have passed since last update.

gitコマンドのプロトコルをhttpsに固定する(社内環境でよくある話)

Last updated at Posted at 2014-06-18

よく忘れるので自分用のメモです。

社内からgitプロトコルは使えないこと多いよね

GithubからSubmoduleゲットしようとした場合とか。
firewallにgitプロトコルが許可されて無くて、↓のように接続できませんってなる。

$ git submodule update --init
()
Cloning into 'fuel/app/vendor/Phamlp'...
fatal: unable to connect to github.com:
github.com[0: 192.30.252.129]: errno=Operation timed out

そらそうだよね〜
ってことで

gitプロトコルの代わりに、httpsプロトコルを使うように設定する

下記2つの方法 git config コマンドと ~/.gitcongih を書き換える で起こる結果は同じものでした。
両方 ~/.gitconfig を書き換えることになるため、ユーザ単位での永続的な設定変更となります。
詳細はこちらをご確認ください。
この記事のコメントへのリンク

yterajima さん、ご指摘ありがとう。

### その場限りならこちらでOK
git config --global url."https://".insteadOf git://
###常にhttpsで通信するなら.gitconfigにこう書く
~/.gitconfig
[url "https://"]
    insteadOf = git://
67
66
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
67
66