LoginSignup
8
6

More than 3 years have passed since last update.

VPN接続 & Proxy配下にてGitが使えなかったのを解決したお話

Last updated at Posted at 2019-12-08

tl;dr

やりたいこと

vpn & 認証付きのproxy配下からpush, cloneしたい

解決した

下記コマンド。http.proxy のあとにプロトコルを記載しない点がポイントです。

$ git config --global http.proxy user:password@path.to.proxy:port
$ git config --global https.proxy user:password@path.to.proxy:port

実行環境

Ubuntu 18.04 (Windows Subsystem for Linux)

$ git --version
git version 2.17.1

困っていた点

ググれば一発で見つかる、proxy環境でgitを使用したい場合に設定するコマンドですよね。

$ git config --global http.proxy http://user:password@path.to.proxy:port
$ git config --global https.proxy http://user:password@path.to.proxy:port

上記設定をしておけば、オフィス内だと通常にpush, clone出来ました。
しかし、vpn接続だとなぜかcloneやpushをしようとした際に、下記エラーが出て悩まされていました。

$ git clone https://github.com/fugafuga/piyopiyo.git
Cloning into 'piyopiyo'...
fatal: unable to access 'https://github.com/fugafuga/piyopiyo.git/': Received HTTP code 407 from proxy after CONNECT

これがなかなか不便で、せっかくリモートワークが許可されている職場なのにpushしたいが為に出社していました。(往復3時間)

解決 🎉🥳👏

下記コマンドのように、プロトコルを記載せずにproxy情報を登録しておけばvpnからでも接続できます。

$ git config --global http.proxy user:password@path.to.proxy:port
$ git config --global https.proxy user:password@path.to.proxy:port

尚、原因は判明していませんので、有識者の方、ぜひ原因を教えて下さいますと嬉しいです

8
6
0

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
8
6