【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

$

相关推荐
程序视点1 小时前
GitHub Copilot代码审查大升级!路径级指令+组织级规范,开发者效率再提升!
github·github copilot
ficker131 小时前
git常用命令
git
行思理6 小时前
linux 安全与防护,全方向讲解
linux·安全·github
NocoBase6 小时前
6 个最佳无代码 IT 资产管理工具推荐
低代码·开源·github
kevin_cat6 小时前
微信群机器人-备份文件发送通知
git·bash·企业微信
uhakadotcom7 小时前
DuckDB相比于ClickHouse有什么不同点和优势?
后端·面试·github
掘金安东尼9 小时前
Node.js 如何在 2025 年挤压 I/O 性能
前端·javascript·github
程序媛Dev10 小时前
50.4k Star!我用这个神器,在五分钟内搭建了一个私有 Git 服务器!
运维·服务器·git
老马啸西风11 小时前
v0.29.1 敏感词性能优化之内部类+迭代器内部类
性能优化·开源·nlp·github·敏感词
杨杨杨大侠12 小时前
第5章:实现Spring Boot集成
java·github·eventbus