How to solve the problem of slow GitHub download speed on MAC

Said it in front

There are many ways to solve the slow download speed of GitHub. This article mainly introduces how to solve the problem of slow download speed through Git mirroring. The main steps are: 1. Find the gitconfig file, 2. View the currently effective config configuration through the git command 3. Use the git config command to edit and add the domestic mirror source

1. Where is the gitconfig file?

Git has a total of 3 configuration files:

  1. Warehouse-level configuration file: .git/.gitconfig in the warehouse. This configuration file is only valid for the warehouse where it is located.
  2. Global configuration file: Mac system is in ~/.gitconfig, Windows system is in C:\Users<username>.gitconfig.
  3. System-level configuration file: gitconfig in the etc folder in the Git installation directory (the installation directory under Mac system is /usr/local/git).

2. Related commands for git config operation

# 查看配置信息
# --local:仓库级,--global:全局级,--system:系统级
$ git config <--local | --global | --system> -l

# 查看当前生效的配置信息
$ git config -l

# 编辑配置文件
# --local:仓库级,--global:全局级,--system:系统级
$ git config <--local | --global | --system> -e

# 添加配置项
# --local:仓库级,--global:全局级,--system:系统级
$ git config <--local | --global | --system> --add <name> <value>

3. Selection of Git mirror source

Since Git is a distributed version control system, Git operations can be performed from multiple mirror sources. Here are some Git images. We can add the nearest Git image to the .git/config file:

1. Mirror source of University of Science and Technology of China

[url "https://mirrors.ustc.edu.cn/git/"]
insteadOf = https://github.com/
insteadOf = https://gitlab.com/
insteadOf = https://bitbucket.com/
2 , Tsinghua University mirror source

[url "https://mirrors.tuna.tsinghua.edu.cn/git/"]
insteadOf = https://github.com/
insteadOf = https://gitlab.com/
insteadOf = https://bitbucket.com /
3. Alibaba Cloud mirror source

[url “https://code.aliyun.com/”]
insteadOf = https://github.com/
insteadOf = https://gitlab.com/
insteadOf = https://bitbucket.com/

reference:

How to solve the problem of slow GitHub download speed

Mac Git configuration global gitconfig

How to see hidden files on Mac (three ways to display hidden files on Mac

Linux study notes - vim text editor

Guess you like

Origin blog.csdn.net/qq_42886163/article/details/133236999