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
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:
- Call ngOnInit() again from another function – Angular 9 ?
- ngOnChanges get new value and previous value – Angular
- Global Angular CLI version is greater than your local version
- Upgrade Angular CLI to the latest version Angular 9 or 10 ?
- How to use new static option in ViewChild Angular 9 ?
- Project contents into angular components using ng-content
- Call ngOnInit() again from another function – Angular 9 ?
- ngAfterContentInit with Example – Angular
- ngAfterViewInit with Example – Angular
- ngAfterContentChecked with Example
- ngOnDestroy Example Angular
- Angular Component : In which lifecycle hook you can check value of DOM element ?
- @ContentChild TypeError: Cannot read property ‘nativeElement’ of undefined
- Access ng-content with @ContentChild – Angular Component
- How to select an element in a component template – Angular ?
- Difference between @ViewChild and @ContentChild – Angular Example
- Expected 0 type arguments, but got 1 : Angular
- Angular – Access template reference variables from component class ?
- Pass variable from parent to custom child component – Angular 9
- Cannot find name ‘Output’ – Angular
- EventEmitter parameter value undefined for listener
- Typescript Error: Property does not exist on value of type
- Node Sass could not find a binding for your current environment