各种换源
in 开发工具 with 0 comment

各种换源

in 开发工具 with 0 comment

整理一些换源的需求:

pip

mac和linux

  1. 创建文件~/.pip/pip.conf,如果已经存在就不用创建:
mkdir ~/.pip
vim ~/.pip/pip.conf
  1. 文件内容为:
[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com

windows

  1. 创建文件%APPDATA%\pip\pip.ini
  2. 文件内容为:
[global]
timeout = 6000
index-url = http://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

其它安装源

上面都是以阿里云安装源为例,除此以外还有一些其它的安装源,替换index-urltrusted-host即可:

npm

npm换源比较简单,一行代码即可:

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

切换完成后可以进行测试:

npm config get registry

yarn

安装tyarn即可,然后用tyarn代替yarn使用,会自动使用淘宝源:

sudo npm install -g yarn tyarn

git

git设置代理

git config --global http.proxy socks5://127.0.0.1:1086
git config --global http.https://github.com.proxy socks5://127.0.0.1:1086

git取消代理

git config --global --unset http.proxy
git config --global --unset http.https://github.com.proxy

cocoapods

pod setup命令过慢时,参照上面的命令为github设置代理即可

gem

  1. 查看gem源
gem source -l
  1. 删除源
gem source -r <源地址>
  1. 添加源
gem sources --add <源地址>

4.目前能用的源 之前淘宝的源已经无法使用,目前能用的源:

https://gems.ruby-china.com