Github code clone速度太慢解决方案

181 阅读1分钟

1. 使用github的镜像网站加速下载(注意仅拉取代码时用,提交代码前需要切换原地址)

git clone https://github.com/chenzhengqiang1024/element3.git
# 在github.com后面加.cnpmjs.org 例如下面的地址
git clone https://github.com.cnpmjs.org/chenzhengqiang1024/element3.git
# 换了地址之后有明显的提升 原地址10kb/s 新地址3mb/s

# 提示: clone完代码记得进入到代码目录后才能进行后面的操作哈

2. 提交代码时指定原github地址

# 切换切换/创建本地分支
git checkout -b 'local_branch'

# 增加原github远程仓库 --git remote add <name> <url>
git remote add origin_github https://github.com/chenzhengqiang1024/element3.git

cd# 推送本地分支到指定远程仓库
# origin_github 远程仓库名称,对应上一步name值
# local_branch  本地分支
# origin_branch 远程仓库分支
git push --progress "origin_github" local_branch:origin_branch

# 如果是私有的库,第一次需要输入账号密码