Git设置代理服务器

方式一

  • 如果说使用的是项目http或者https地址,就配置http与https代理即可,输入以下命令:
shell 复制代码
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"

这样使用git clone/push/pull所有http或者https地址项目都会走代理。

  • 还可以使用下面命令取消代理设置:
shell 复制代码
git config --global --unset http.proxy
git config --global --unset https.proxy

方式二

  • 在.git中的config文件中增加
shell 复制代码
[http]
    proxy = http://127.0.0.1:1080
[https]
    proxy = http://127.0.0.1:1080
相关推荐
运维全栈笔记1 天前
零基础掌握Jenkins CI/CD:Java项目自动构建与部署全流程指南
git·servlet·ci/cd·gitee·自动化·jenkins·devops
菜萝卜子1 天前
【Git】GitLab 18.9 全局服务器钩子(Server Hooks)官方规范与落地实践
服务器·git·gitlab
用户11481867894841 天前
Git Stash 丢失后的完整找回指南
前端·git
Ting.~1 天前
GIT详解
java·笔记·git
克拉拉KLARA1 天前
vscode禁用在git提交中插入ai coauthor copilot
git·vscode·copilot
水无痕simon1 天前
05 Git 基础 – 查看提交历史
git
谢斯1 天前
【GIT】子模块初始化与排错记录
git
遇见火星1 天前
离线服务器时间同步NTP服务器配置
服务器·git·github
Soari1 天前
Claude Code每日更新速览(v2.1.120-2026/04/27)-彻底摆脱 Git Bash,CI 级代码审查工具上线
git·ci/cd·bash·cluade code·ai for coding
芝士就是力量啊 ೄ೨1 天前
如何配置Rust、Git,并从Github上拉下一个项目
git·rust·github