> 技术文档 > GitHub 配置与镜像(查询、更换、移除)_github镜像配置

GitHub 配置与镜像(查询、更换、移除)_github镜像配置


查看当前镜像

  • 指令

    $ git config --list --show-origin
  • 输出信息

    file:/opt/homebrew/etc/gitconfig credential.helper=osxkeychainfile:/Users/dengzemiao/.gitconfig user.name=dengzemiaofile:/Users/dengzemiao/.gitconfig user.email=dengzemiaovip@163.comfile:/Users/dengzemiao/.gitconfig http.postbuffer=5242880000file:/Users/dengzemiao/.gitconfig http.lowspeedlimit=0file:/Users/dengzemiao/.gitconfig http.lowspeedtime=999999file:/Users/dengzemiao/.gitconfig filter.lfs.clean=git-lfs clean -- %ffile:/Users/dengzemiao/.gitconfig filter.lfs.smudge=git-lfs smudge -- %ffile:/Users/dengzemiao/.gitconfig filter.lfs.process=git-lfs filter-processfile:/Users/dengzemiao/.gitconfig filter.lfs.required=truefile:/Users/dengzemiao/.gitconfig url.https://hub.fastgit.org/.insteadof=https://github.com/file:.git/config core.repositoryformatversion=0file:.git/config core.filemode=truefile:.git/config core.bare=falsefile:.git/config core.logallrefupdates=truefile:.git/config core.ignorecase=truefile:.git/config core.precomposeunicode=truefile:.git/config remote.origin.url=https://gitee.com/dengzemiao/flutter-edu-app.gitfile:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*file:.git/config branch.master.remote=originfile:.git/config branch.master.merge=refs/heads/masterfile:.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

    细节:添加用的哪个链接,移除也得用哪个链接,每次添加都是额外加一个,不是覆盖。