Overcome the Wall
Living in China you just have to make a lot of effort to overcome the GFW(aka, Great Firewall).
Personally I strongly recommend Monocloud to accelerate network access in China. Running the client will start a proxy running on 7078 port based on TCP and UDP protocol. Meanwhile it also turns on proxy in internet settings:
The following walkthrough presumes that you have started monocloud.
Github
Sometimes cloning a repo from github will return a connection timeout or connection reset error. You know why.
To use git behind a proxy:
1 | git config --global http.proxy http://127.0.0.1:7078 |
Although http.proxy
indicates it is a http proxy, it seems to work for both http and https as cloning github repos are on 443 port.
Once the proxy is no longer needed:
1 | git config --global unset http.proxy |
npm
Thanks to Taobao, all salute Tabao! Here’s the command to switch original npm repository to Taobao’s mirror repository:
1 | npm config set registry https://registry.npm.taobao.org |
Test if successful:
1 | npm info express |
Note that registry.npmmirror.com
is the new domain for registry.npm.taobao.org
.
Restore original repository:
1 | npm config set registry https://registry.npmjs.org |
A Beijing coder contributed an npm registry management tool nrm
:
1 | npm install -g nrm |
Easy and up-to-date.
Overcome the Wall