Skip to content

helloint/proxy-git-npm-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Proxy Setting for Command Line Programs (CLI)

Instruction

Some Command Line Programs doesn't use system proxy setting by default. You need to setup manually.
Here suppose 172.16.0.33:1080 is your proxy server:

SSH (Doc)

Usage: Git command via SSH will need this.
Window:
C:\Users\${YOUR_USER}\.ssh\config (Create if not exist)

Host github.com
  ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -H 172.16.0.33:1080 %h %p

macOS / Linux:
~/.ssh/config (Create if not exist)

Host github.com
  ProxyCommand nc -x 172.16.0.33:1080 %h %p

Git (Doc)

Usage: Git command via http/https will need this.
Set for specific host

-- Set
git config --global http.https://github.saobby.my.eu.org.proxy http://172.16.0.33:1080

-- Unset
git config --global --unset http.https://github.saobby.my.eu.org.proxy

Or edit C:\Users\${YOUR_USER}\.gitconfig on Windows, ~/.gitconfig on macOS or Linux manually

[http "https://github.com"]
        proxy = http://172.16.0.33:1080

NPM (Doc)

Usage: For npm install to download packages from NPM registry. Note that some packages will have dependencies that are from GitHub via either https or SSH, that will need Git and SSH proxy above.

-- Set
npm config set https-proxy http://172.16.0.33:1080
npm config set proxy http://172.16.0.33:1080
-- Bypass internal registry, can't use proxy
npm config set noproxy npm.neulion.net.cn

-- Unset
npm config rm https-proxy
npm config rm proxy

Or edit C:\Users\${YOUR_USER}\.npmrc on Windows, ~/.npmrc on macOS or Linux manually

https-proxy=http://172.16.0.33:1080/
proxy=http://172.16.0.33:1080/
noproxy=npm.neulion.net.cn

Mac Terminal

export https_proxy="http://172.16.0.33:1080"

Only affect current window

About

Proxy setting for Git, npm, SSH

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published