【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 [email protected]: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

$

相关推荐
ice___Cpu3 小时前
Git - 1( 14000 字详解 )
大数据·git·elasticsearch
Yvonne爱编码3 小时前
CSS- 2.1 实战之图文混排、表格、表单
前端·css·html·github·状态模式·html5·hbuilder
qianmoQ13 小时前
GitHub 趋势日报 (2025年05月11日)
github
Yvonne爱编码14 小时前
HTML-3.3 表格布局(学校官网简易布局实例)
前端·html·github·html5·hbuilder
范纹杉想快点毕业18 小时前
以项目的方式学QT开发(一)——超详细讲解(120000多字详细讲解,涵盖qt大量知识)逐步更新!
c语言·数据结构·c++·git·qt·链表·github
qq_6536444620 小时前
如何查看打开的 git bash 窗口是否是管理员权限打开
开发语言·windows·git·bash
tonngw20 小时前
【Mac 从 0 到 1 保姆级配置教程 12】- 安装配置万能的编辑器 VSCode 以及常用插件
git·vscode·后端·macos·开源·编辑器·github
八股文领域大手子21 小时前
HTTP/1.1 host虚拟主机详解
github
橄榄熊1 天前
Git 常用命令详解
git
HORSE RUNNING WILD1 天前
解决 PicGo 上传 GitHub图床及Marp中Github图片编译常见难题指南
css·python·github