remove http and https proxy settings of npm and git

How to remove http and https proxy settings of npm and git ?

This tutorial guides you on how to remove http and https proxy settings of npm and git. You will also learn how to configure npm and git to use proxy.

Remove http and https proxy settings of npm

remove http and https proxy settings of npm and git

Note, you may need to configure proxy server settings if you are having trouble in downloading node dependencies from a remote repository. Hence, you need to check whether current proxy settings of npm are correct or you may need to remove them.

To remove http and https proxy settings of npm, I tried to do the following and it worked.

> npm config rm proxy
> npm config rm https-proxy

Similarly, using “delete” also worked instead of  “rm” in the npm config command as shown below.

> npm config delete http-proxy
> npm config delete https-proxy

To verify whether http and https proxy settings of npm are removed or not, you can do the following and see if it returns null.

> npm config get https-proxy
null

> npm config get proxy
null

Note, the following combinations are allowed while using npm config. But make sure that you pass the right/ appropriate <key> and <value>.

> npm config

npm ERR! Usage:
npm ERR! npm config set <key> <value>
npm ERR! npm config get [<key>]
npm ERR! npm config delete <key>
npm ERR! npm config list [--json]
npm ERR! npm config edit
npm ERR! npm set <key> <value>
npm ERR! npm get [<key>]
npm ERR!
npm ERR! alias: c

To list all the config settings, try running the following command.

> npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.6 node/v12.18.3 win32 x64"

; builtin config undefined
prefix = "C:\\Users\990\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\Users990
; HOME = C:\Users990
; "npm config ls -l" to show all defaults.

Use –json in the end to check the settings or config in the json format.

> npm config list --json

Similarly, let’s see how to unset or remove http and https proxy settings of git.

Remove http and https proxy settings of Git

To remove http and https proxy settings of Git try to run the following command. The –unset flag used in the command will remove the configuration specified.

> git config --global --unset http.proxy
> git config --global --unset https.proxy

Once the proxy settings are removed from gitconfig, to verify proxy settings for git.

> git config --global --list

After, removing the existing or incorrect proxy settings if you need to configure or set proxy settings again the follow the below section.

Configure proxy settings for npm and git

To configure http and https proxy settings for npm.

> npm config set proxy http://<proxy-server-address>:8080
> npm config set https-proxy https://<proxy-server-address>:8080

Similarly, to configure the proxy settings for git.

> git config --global http.proxy http://<proxy-server-address>:808
> git config --global https.proxy https://<proxy-server-address>:8080

That’s all. You had learnt how to remove http and https proxy settings of npm and git. Also, learnt how to reconfigure them and verify.

Hope it helped 🙂

Also see:

References:

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments