0
1

More than 3 years have passed since last update.

【Go環境構築】go getのプロキシ設定

Posted at

はじめに

社内でGo環境構築中に、go getのプロキシ突破で少し手こずったので備忘録。

環境

  • windows10
  • 社内ネットワーク(プロキシ環境下)

プロキシ設定なしの場合のgo getエラーメッセージ

C:\Users\xxxx>go get github.com/gin-gonic/gin
# cd .; git clone -- https://github.com/gin-gonic/gin C:\Users\xxxx\go\src\github.com\gin-gonic\gin
Cloning into 'C:\Users\xxxx\go\src\github.com\gin-gonic\gin'...
fatal: unable to access 'https://github.com/gin-gonic/gin/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
package github.com/gin-gonic/gin: exit status 128

要約すると、githubリポジトリにアクセスできないと言っている。

プロキシ設定

コマンドプロンプトで下記コマンドを実行。

git config --global http.proxy http://proxy.example.com:8080
git config --global https.proxy http://proxy.example.com:8080
git config --global http.sslVerify false 

また、設定内容は.gitconfigファイルに記述されている。
デフォルトではたぶんC:\Users\{username}に存在している。
下記のように記述されていればOK。

.gitconfig
[http]
    proxy = "http://proxy.example.com:8080"
    sslVerify = false
[https]
    proxy = "http://proxy.example.com:8080"

設定後、エラーが出なければ成功している。

参考ページ

proxy内でGo環境の構築
GitコマンドをProxy環境可で利用する。

0
1
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
0
1