查看当前镜像
-
指令
$ git config --list --show-origin
-
输出信息
file:/opt/homebrew/etc/gitconfig credential.helper=osxkeychain file:/Users/dengzemiao/.gitconfig user.name=dengzemiao file:/Users/dengzemiao/.gitconfig user.email=dengzemiaovip@163.com file:/Users/dengzemiao/.gitconfig http.postbuffer=5242880000 file:/Users/dengzemiao/.gitconfig http.lowspeedlimit=0 file:/Users/dengzemiao/.gitconfig http.lowspeedtime=999999 file:/Users/dengzemiao/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:/Users/dengzemiao/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:/Users/dengzemiao/.gitconfig filter.lfs.process=git-lfs filter-process file:/Users/dengzemiao/.gitconfig filter.lfs.required=true file:/Users/dengzemiao/.gitconfig url.https://hub.fastgit.org/.insteadof=https://github.com/ file:.git/config core.repositoryformatversion=0 file:.git/config core.filemode=true file:.git/config core.bare=false file:.git/config core.logallrefupdates=true file:.git/config core.ignorecase=true file:.git/config core.precomposeunicode=true file:.git/config remote.origin.url=https://gitee.com/dengzemiao/flutter-edu-app.git file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* file:.git/config branch.master.remote=origin file:.git/config branch.master.merge=refs/heads/master file:.git/config branch.1.0.0.vscode-merge-base=origin/master
这条就是镜像,如果没有则说明没配置。
file:/Users/dengzemiao/.gitconfig url.https://hub.fastgit.org/.insteadof=https://github.com/
设置镜像
-
指令
配置
Git
使用 GitClone 镜像代替GitHub
官方的URL
的。因为GitHub
在国内的访问速度较慢或不稳定,通过使用FastGit
等镜像源可以提高访问速度和稳定性。$ git config --global url."https://gitclone.com/".insteadOf "https://github.com/"
设置好后,再次执行查询指令就能看到了。
细节:添加用的哪个链接,移除也得用哪个链接,每次添加都是额外加一个,不是覆盖。
-
其他镜像:
可以通过
$ ping gitclone.com
镜像测试是否可用。-
GitClone:
https://gitclone.com/
也是另一个 GitHub 镜像站点,可以用来加速 GitHub 的下载速度。 -
FastGit:
https://hub.fastgit.org/
是一个开源的 GitHub 镜像服务,它提供了更快的访问速度。 -
GitHub中国镜像(GitHub CN Mirror) : 例如,
https://github.com.cnpmjs.org/
也是一个GitHub
的镜像站点,国内用户可以通过该镜像快速访问GitHub
上的开源代码库。 -
更多…
-
移除镜像
-
指令
$ git config --global --unset url."https://gitclone.com/".insteadOf
细节:添加用的哪个链接,移除也得用哪个链接,每次添加都是额外加一个,不是覆盖。