新聞中心
GitHub是一個(gè)面向開源及私有軟件項(xiàng)目的托管平臺(tái),因?yàn)橹恢С諫it 作為唯一的版本庫(kù)格式進(jìn)行托管,故名GitHub。由于GitHub是一個(gè)國(guó)外網(wǎng)站,所以國(guó)內(nèi)訪問(wèn)速度非常慢,本篇文章為大家講解一下github加速解決方案。

1 使用 Github Mirror 下載
直接在 GitHub 倉(cāng)庫(kù)前面拼接 Proxy 地址,不同的 Mirror 拼接方式可能有所不同。下面以拉取 https://github.com/shaowenchen/scripts 倉(cāng)庫(kù)為例。
$ git clone https://mirror.ghproxy.com/https://github.com/shaowenchen/scripts
$ git clone https://github.com.cnpmjs.org/shaowenchen/scripts
2 通過(guò) Gitee 導(dǎo)入 GitHub 項(xiàng)目
可以參考文檔: GitHub倉(cāng)庫(kù)快速導(dǎo)入Gitee及同步更新, 將 GitHub 倉(cāng)庫(kù)導(dǎo)入 Gitee。然后使用 Gitee 的地址拉取代碼。
文檔鏈接:https://gitee.com/help/articles/4284
3 配置 Github Host 地址
打開 https://www.ipaddress.com/ 查詢 github.com 的 IP 地址
編輯本地 /etc/hosts 文件,添加如下內(nèi)容:
140.82.112.4 github.com
或者直接使用開源項(xiàng)目 GitHub520 獲取最新的 IP 地址。
項(xiàng)目地址:https://github.com/521xueweihan/GitHub520
接著就可以拉取代碼了,但是速度并不會(huì)很快,因?yàn)?Github 用的是美國(guó) IP。
4 配置命令行代理
如果有可用的代理服務(wù),那么在本地 Terminal 中配置代理即可。
# Proxy
function proxy_off(){
unset http_proxy
unset HTTP_PROXY
unset https_proxy
unset HTTPS_PROXY
echo -e "已關(guān)閉代理"
}
function proxy_on(){
export http_proxy="http://127.0.0.1:1087";
export HTTP_PROXY="http://127.0.0.1:1087";
export https_proxy="http://127.0.0.1:1087";
export HTTPS_PROXY="http://127.0.0.1:1087";
echo -e "已開啟代理"
}
分享題目:GitHub加速解決方案
文章地址:http://www.dlmjj.cn/article/cdochjj.html


咨詢
建站咨詢
