NPM configuration
Use these commands:
1
2npm config set proxy http://username:[email protected]:port
npm config set https-proxy http://username:[email protected]:portOr you can edit directly your
~/.npmrc
file: 1
2
3proxy=http://username:[email protected]:port
https-proxy=http://username:[email protected]:port
https_proxy=http://username:[email protected]:portYarn configuration
Use these commands:
1
2yarn config set proxy http://username:[email protected]:port
yarn config set https-proxy http://username:[email protected]:portGit configuration
Use these commands:
1
2git config --global http.proxy http://username:[email protected]:port
git config --global https.proxy http://username:[email protected]:portOr you can edit directly your
~/.gitconfig
file: 1
2
3
4[http]
proxy = http://username:[email protected]:port
[https]
proxy = http://username:[email protected]:portMaven configuration
Edit the
proxies
session in your~/.m2/settings.xml
file: 1
2
3
4
5
6
7
8
9
10
11
12<proxies>
<proxy>
<id>id</id>
<active>true</active>
<protocol>http</protocol>
<username>username</username>
<password>password</password>
<host>host</host>
<port>port</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
</proxies>Maven Wrapper
Create a new file
.mvn/jvm.config
inside the project folder and set the properties accordingly: 1
2
3
4
5
6-Dhttp.proxyHost=host
-Dhttp.proxyPort=port
-Dhttps.proxyHost=host
-Dhttps.proxyPort=port
-Dhttp.proxyUser=username
-Dhttp.proxyPassword=passwordGradle configuration
Add the below in your
gradle.properties
file and in yourgradle/wrapper/gradle-wrapper.properties
file if you are downloading the wrapper over a proxyIf you want to set these properties globally then add it in
USER_HOME/.gradle/gradle.properties
file 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16## Proxy setup
systemProp.proxySet="true"
systemProp.http.keepAlive="true"
systemProp.http.proxyHost=host
systemProp.http.proxyPort=port
systemProp.http.proxyUser=username
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=local.net|some.host.com
systemProp.https.keepAlive="true"
systemProp.https.proxyHost=host
systemProp.https.proxyPort=port
systemProp.https.proxyUser=username
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=local.net|some.host.com
## end of proxy setupDocker
Native Docker
Depending on your OS, you have to edit a specific file (
/etc/sysconfig/docker
or/etc/default/docker
).Then, you have to restart the docker service with:
sudo service docker restart
.It will not apply to systemd. See this page from docker to configure the proxy.
Docker with docker-machine
You can create your docker-machine with:
1
2
3
4docker-machine create -d virtualbox \
--engine-env HTTP_PROXY=http://username:[email protected]:port \
--engine-env HTTPS_PROXY=http://username:[email protected]:port \
defaultOr you can edit the file
~/.docker/machine/machines/default/config.json
.
05实用技术/常用工具设置代理
- 更新时间:2021-05-09 02:50
- 创建时间:2021-05-09 02:48