编程环境设置

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 @   卓能文  阅读(103)  评论(0编辑  收藏  举报
编辑推荐:
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 25岁的心里话
点击右上角即可分享
微信分享提示