一、http/https代理
1.1 使用本地代理
Windows和Ubuntu在终端输入下方对应命令即可成功代理 http 方式的 git clone命令。
记得将8080/1080改成自己代理软件的http/socks5端口。
# 设置 http 代理
git config --global http.proxy "http://127.0.0.1:8080"
git config --global https.proxy "http://127.0.0.1:8080"
# 或者 socks5 代理
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"
# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy
1.1.1 Windows设置别名
1.1.2 Ubuntu设置别名
编辑shell
配置文件
# zsh
sudo nano ~/.zshrc
# bash
sudo nano ~/.bashrc
在配置文件末尾加上以下内容:
alias proxygit="git config --global http.proxy 'socks5://127.0.0.1:1089' && git config --global https.proxy 'socks5://127.0.0.1:1089'"
alias unproxygit="git config --global --unset http.proxy && git config --global --unset https.proxy"
保存后,启用配置文件
# zsh
source ~/.zshrc
# bash
source ~/.bashrc
1.2 使用FastGit代理
1.2.1 使用 FastGit 替换所有指向 GitHub 的链接
# 使用 FastGit 替换所有指向 GitHub 的链接
git config --global url."https://hub.fastgit.xyz/".insteadOf "https://github.com/"
git config protocol.https.allow always
# 查看git配置信息
git config --global --list
# 取消替换
git config --global --unset url."https://hub.fastgit.xyz/".insteadof
注意
FastGit不支持超过 2GiB 的仓库的 clone
1.2.2 直接替换git clone的远程地址
# 常规的面向 GitHub 的 clone 命令可能如下:
git clone https://github.com/author/repo
# 使用 FastGit 时,可使用如下命令:
git clone https://hub.fastgit.xyz/author/repo
Release 和源码存档的下载以及SSH 操作、raw
均可以使用直接替换远程地址的方法,替换地址如下:
# Release
# 假设下载链接为https://github.com/A/A/releases/download/1.0/1.0.zip
wget https://download.fastgit.org/A/A/releases/download/1.0/1.0.zip
# Codeload
# 假设下载链接为 https://hub.fastgit.xyz/A/A/archive/master.zip
# 或者 https://codeload.github.com/A/A/zip/master
wget https://download.fastgit.org/A/A/archive/master.zip
# SSH
# 假设下载链接为 git@github.com:A/B.git
git clone git@ssh.fastgit.org:A/B.git
# Raw
# 假设下载链接为 https://raw.githubusercontent.com/A/A/master/README.md
wget https://raw.fastgit.org/A/A/master/README.md
原文地址:http://www.cnblogs.com/leebri/p/16810644.html
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,请务用于商业用途!
3. 如果你也有好源码或者教程,可以到用户中心发布,分享有积分奖励和额外收入!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 如遇到加密压缩包,默认解压密码为"gltf",如遇到无法解压的请联系管理员!
8. 因为资源和程序源码均为可复制品,所以不支持任何理由的退款兑现,请斟酌后支付下载
声明:如果标题没有注明"已测试"或者"测试可用"等字样的资源源码均未经过站长测试.特别注意没有标注的源码不保证任何可用性