Create a gist now

Instantly share code, notes, and snippets.

Proxy configuration by command line for some tools

Yarn configuration

yarn config set proxy http://username:password@host:port yarn config set https-proxy http://username:password@host:port

NPM configuration

npm config set proxy http://username:password@host:port npm config set https-proxy http://username:password@host:port

Or you can edit directly your ~/.npmrc file:

proxy=http://username:password@host:port https-proxy=http://username:password@host:port https_proxy=http://username:password@host:port

Git configuration

git config --global http.proxy http://username:password@host:port git config --global https.proxy http://username:password@host:port

Or you can edit directly your ~/.gitconfig file:

[http] proxy = http://username:password@host:port [https] proxy = http://username:password@host:port

Bower configuration

Edit your ~/.bowerrc file:

{ "proxy":"http://username:password@host:port", "https-proxy":"http://username:password@host:port" }

Maven configuration

Edit the proxies session in your ~/.m2/settings.xml file

id true http username password host port|

Maven Wrapper

Create a new file .mvn/jvm.config inside the project folder and set the properties accordingly:

-Dhttp.proxyHost=host -Dhttp.proxyPort=port -Dhttps.proxyHost=host -Dhttps.proxyPort=port -Dhttp.proxyUser=username -Dhttp.proxyPassword=password


Native Docker

Depending on your OS, you have to edit a specific file (/etc/sysconfig/docker or /etc/default/docker).

Then, restart the docker service with: sudo service docker restart.

It will not apply to systemd. See this page:

Docker with docker-machine

You can create your docker-machine with:

docker-machine create -d virtualbox
--engine-env HTTP_PROXY=http://username:password@host:port
--engine-env HTTPS_PROXY=http://username:password@host:port

Or you can edit the file ~/.docker/machine/machines/default/config.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment