【git】配置代理访问github

github经常Couldn't connect to server

cpp 复制代码
zhangbin@DESKTOP-1723CM1 MINGW64 /g/CDN/NET-EQ-DEV
$ git clone https://github.com/TaoistKing/AudioPlc.git
Cloning into 'AudioPlc'...
fatal: unable to access 'https://github.com/TaoistKing/AudioPlc.git/': Failed to connect to github.com port 443 after 21266 ms: Couldn't connect to server

本人路径

  • C:\Users\zhangbin.ssh

在个人目录下的.ssh/config 增加这个不管用

bash 复制代码
Host github.com *.github.com # 指定代理规则作用域
  User git
  Port 22 # 端口号
  # 自己的私钥所在路径
  IdentityFile "~/.ssh/id_rsa"
  # SOCKS代理设置方法
  ProxyCommand connect -S 127.0.0.0:7891 %h %p
  # HTTPS代理设置方法
  ProxyCommand connect -H 127.0.0.0:7890 %h %p

报错

cpp 复制代码
zhangbin@DESKTOP-1723CM1 MINGW64 /g/CDN/NET-EQ-DEV
$ git clone git@github.com:TaoistKing/AudioPlc.git
Cloning into 'AudioPlc'...
FATAL: Unable to connect to relay host, errno=10060
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

单独给github设置代理

通过clash

  • 一定要allow lan
  • 一定有system proxy

zhangbin@DESKTOP-1723CM1 MINGW64 /g/CDN/NET-EQ-DEV

bash 复制代码
$ git config --global http.https://github.com.proxy socks5://127.0.0.1:7890
bash 复制代码
git config --global https.https://github.com.proxy socks5://127.0.0.1:7890

zhangbin@DESKTOP-1723CM1 MINGW64 /g/CDN/NET-EQ-DEV

$ git clone https://github.com/TaoistKing/AudioPlc.git

Cloning into 'AudioPlc'...

remote: Enumerating objects: 172, done.

remote: Counting objects: 100% (172/172), done.

remote: Compressing objects: 100% (150/150), done.

remote: Total 172 (delta 21), reused 166 (delta 19), pack-reused 0

Receiving objects: 100% (172/172), 392.65 KiB | 561.00 KiB/s, done.

Resolving deltas: 100% (21/21), done.

zhangbin@DESKTOP-1723CM1 MINGW64 /g/CDN/NET-EQ-DEV

$

相关推荐
流量猎手14 分钟前
上传github为什么优先创建.gitignore
github
逛逛GitHub2 小时前
概念版德州扑克功能,还真应有意思的,不过 Codex并没上线
github
晴天163 小时前
GitBook 与 GitHub 的关系-Day24
github
dong_junshuai3 小时前
每天一个开源项目#74 OpenViking:3万星Agent上下文数据库
开源·github·agent
胡萝卜术3 小时前
从"氛围编程"到规范驱动:两次创造如何让 AI 协作从碰运气变成工程流水线
前端·面试·github
小弥儿3 小时前
GitHub今日热榜 | 2026-08-20:Agent 上下文数据库接棒
数据库·学习·开源·github
小妖同学学AI4 小时前
GitHub上16k星的“未来编辑器”:像Notion一样排版,像ChatGPT一样自动续写
编辑器·github·notion
程序员阿卢4 小时前
Github Copilot 新手极速上手指南
github·copilot·ai编程助手·开发工具集成
小帅不太帅4 小时前
我把金博士使用 GPT 证明 Crouzeix 猜想的方法做成了一个 deep-learn 技能
前端·github·agent
三十而立洋4 小时前
GitHub 项目创建指南:实际应用场景与常见权限问题详解
github