编程环境设置

github设置

github代理设置

经常从github克隆或更新代码时,速度很慢,因此需要设置代理访问。常用的代理有:

https://github.com.cnpmjs.org/
https://hub.fastgit.org/

采用如下的命令进行设置:

git config --global url."https://hub.fastgit.org/".insteadOf "https://github.com/"
git config --global protocol.https.allow always

最近由于github的限制,访问时好时坏,目前没有比较稳定的解决办法。可以通过修改当前用户的git配置文件,设置成其它的代理服务器试试看能否正常访问。

vim ~/.gitconfig

github文件下载

可通过https://ghproxy.com/https://gh.api.99988866.xyz/直接进行克隆或下载,如:

git clone https://ghproxy.com/https://github.com/stilleshan/ServerStatus
wget https://ghproxy.com/https://github.com/stilleshan/ServerStatus/archive/master.zip
wget https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile
curl -O https://ghproxy.com/https://github.com/stilleshan/ServerStatus/archive/master.zip
curl -O https://ghproxy.com/https://raw.githubusercontent.com/stilleshan/ServerStatus/master/Dockerfile

也可以用浏览器打开上述网址,在输入框中输入要下载的内容,单击下载按钮进行下载。

node设置

原始设置

npm config set registry http://registry.npmjs.org

设置国内镜像

通过config命令

npm config set registry https://registry.npm.taobao.org

如果设置正确,通过下面命令检查

npm info underscore

命令行指定

npm --registry https://registry.npm.taobao.org info underscore

编辑 ~/.npmrc 加入下面内容

registry = https://registry.npm.taobao.org

使用nrm管理registry地址

下载nrm

npm install -g nrm

添加registry地址

nrm add npm http://registry.npmjs.org
nrm add taobao https://registry.npm.taobao.org

切换npm registry地址

nrm use taobao
nrm use npm
posted @ 2021-08-28 23:52  卓能文  阅读(125)  评论(0)    收藏  举报