Tourismプロジェクトのブログ

活動の様子やメンバーの興味があることを書いていきます!

npm yarn Gitのproxy(プロキシ)設定・解除方法

はじめに

この記事は、npm・yarn・Gitの3つのプロキシ設定によく引っかかるので、書き留めておこうと思う。

設定・解除・確認のカテゴリで書いていく。

各バージョン

本稿は以下のバージョンで実行している。

$ npm --version
7.11.2

$ yarn --version
1.22.10

$ git --version
git version 2.30.0

proxyの設定・解除・確認

本稿はすべてID & Pass なしで記述する。

*以下、プロキシサーバーを
http://wwwproxyserver:port
又は
https://wwwproxyserver:port
と記述する

proxyの設定

// npm
$ npm -g config set proxy http://wwwproxyserver:port
$ npm -g config set https-proxy https://wwwproxyserver:port

// yarn
$ yarn config set proxy http://wwwproxyserver:port
$ yarn config set https-proxy https://wwwproxyserver:port

// git
$ git config --global http.proxy http://wwwproxyserver:port
$ git config --global https.proxy https://wwwproxyserver:port

proxyの解除

// npm
$ npm -g config delete proxy 
$ npm -g config delete https-proxy

// yarn
$ yarn config delete proxy
$ yarn config delete https-proxy

// git
$ git config --global --unset http.proxy
$ git config --global --unset https.proxy

proxyの確認

実行結果を確認するには、以下のコマンドを実行しましょう。

// npm
$ npm config list

// yarn
$ yarn config list

// git
$ git config --global --list