說在前面
解決github下載速度慢的方法很多,本文主要介紹通過Git鏡像的方式解決下載慢的問題。 主要步驟有:1、找到gitconfig文件, 2、通過git命令查看當(dāng)前生效的config 配置 3、使用git config命令編輯并添加國內(nèi)鏡像源
1、gitconfig 文件在哪里?
Git 一共有3個配置文件:
- 倉庫級的配置文件:在倉庫的 .git/.gitconfig,該配置文件只對所在的倉庫有效。
- 全局配置文件:Mac 系統(tǒng)在 ~/.gitconfig,Windows 系統(tǒng)在 C:\Users<用戶名>.gitconfig。
- 系統(tǒng)級的配置文件:在 Git 的安裝目錄下(Mac 系統(tǒng)下安裝目錄在 /usr/local/git)的 etc 文件夾中的 gitconfig。
2、git config 操作的相關(guān)命令
# 查看配置信息
# --local:倉庫級,--global:全局級,--system:系統(tǒng)級
$ git config <--local | --global | --system> -l
# 查看當(dāng)前生效的配置信息
$ git config -l
# 編輯配置文件
# --local:倉庫級,--global:全局級,--system:系統(tǒng)級
$ git config <--local | --global | --system> -e
# 添加配置項
# --local:倉庫級,--global:全局級,--system:系統(tǒng)級
$ git config <--local | --global | --system> --add <name> <value>
3、Git鏡像源的選擇
由于Git是分布式的版本控制系統(tǒng),可以從多個鏡像源進行Git操作。這里提供一些Git鏡像,我們可以將就近的Git鏡像加入.git/config文件中:
1、中科大鏡像源
[url “https://mirrors.ustc.edu.cn/git/”]
insteadOf = https://github.com/
insteadOf = https://gitlab.com/
insteadOf = https://bitbucket.com/
2、清華大學(xué)鏡像源
[url “https://mirrors.tuna.tsinghua.edu.cn/git/”]
insteadOf = https://github.com/
insteadOf = https://gitlab.com/
insteadOf = https://bitbucket.com/
3、阿里云鏡像源
[url “https://code.aliyun.com/”]
insteadOf = https://github.com/
insteadOf = https://gitlab.com/
insteadOf = https://bitbucket.com/
參考:
如何解決GitHub下載速度慢的問題
Mac Git 配置全局gitconfig
mac上怎么看隱藏文件(顯示Mac隱藏文件的三種方式文章來源:http://www.zghlxwxcb.cn/news/detail-718762.html
Linux 學(xué)習(xí)筆記 - vim文本編輯器文章來源地址http://www.zghlxwxcb.cn/news/detail-718762.html
到了這里,關(guān)于MAC 如何解決GitHub下載速度慢的問題的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!