【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

$

相关推荐
朱颜辞镜花辞树‎25 分钟前
GitHub 操作指南:项目协作与自动化工作流实践
运维·自动化·github
音元系统1 小时前
Copilot 在 VS Code 中的免费替代方案
python·github·copilot
ai小鬼头5 小时前
AIStarter3.0.2全新发布:解锁用户、创作者、共创模式,轻松玩转AI项目
人工智能·程序员·github
寻月隐君7 小时前
用 Rust 实现 HTTPie:一个现代 CLI 工具的构建过程
后端·rust·github
徐小夕8 小时前
开源了一款基于Nextjs实现的精美CRM系统, 卷王程序员狂喜!
前端·react.js·github
Casia_Dominic10 小时前
【三维重建工具】NeRFStudio、3D GaussianSplatting、Colmap安装与使用指南
git·3d·github·点云
构建的乐趣10 小时前
运行ssh -T git@github.com报错
git·ssh·github
寻月隐君19 小时前
想用 Rust 开发游戏?这份超详细的入门教程请收好!
后端·rust·github
SoFlu软件机器人1 天前
Cursor、飞算JavaAI、GitHub Copilot、Gemini CLI 等热门 AI 开发工具合集
人工智能·github·copilot
落雪小轩韩1 天前
Git 常用操作与注意事项全攻略
大数据·git