GitへProxy経由で接続する
認証なしProxyの場合
gitのproxy設定を行いましょう.
$ git config --global http.proxy http://proxy_host:proxy_port $ git config --global https.proxy http://proxy_host:proxy_port
認証ありProxyの場合
Proxyのドメイン名の前に認証情報(user:pass と @マーク)を付与する.
$ git config --global http.proxy http://user:pass@proxy_host:proxy_port $ git config --global https.proxy http://user:pass@proxy_host:proxy_port
※ユーザ認証情報 @ が含まれる場合、該当文字はURLエンコードした値(%40)を設定しましょう.
< http://hoge@fuga.com:pass@proxy_host:proxy_port --- > http://hoge%40fuga.com:pass@proxy_host:proxy_port
特定のドメインのみでProxyを有効にする方法
特定のドメイン(https://example.com/)のみ、Proxyを通したい場合は http.https://example.com.proxy といった具合にURLをキーとして指定する.
$ git config --global http.https://example.com/.proxy http://user:pass@proxy_host:proxy_port
うまく行かない場合
設定値の確認
~/.gitconfig
をみて設定が意図通りうまく出来てるかチェックしましょう.
$ cat ~/.gitconfig ... [http] proxy = http://user:pass@proxy_host:proxy_port [https] proxy = http://user:pass@proxy_host:proxy_port [http "https://example.com/"] proxy = http://user:pass@proxy_host:proxy_port [https "https://example.com/"] proxy = http://user:pass@proxy_host:proxy_port
設定値を削除したい場合
--unset サブコマンドを使えばよい.
$ git config --global --unset http.proxy