git 提交代码提示Unable to connect to relay host
2024年4月28日大约 1 分钟
背景
在使用git bash或Idea提交代码时,提示Unable to connect to relay host。
排查:ssh秘钥没有过期,google、github正常访问
报错
FATAL: Unable to connect to relay host, errno=10061 Connection closed by UNKNOWN port 65535 Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
原因是:
在clash中修改了端口为13174,而配置(C:/Users/buttyme/.ssh/config)中并没有修改,导致提交失败。
解决方法
在 C:/Users/buttyme/.ssh/config 修改端口即可解决
参考配置:
# github
Host imnxg.github.com
HostName ssh.github.com
IdentityFile ~/.ssh/id_ed25519_github_liming
User liming
Port 443
ProxyCommand "D:\software\Git\mingw64\bin\connect.exe" -S 127.0.0.1:13174 %h %p
扩展
在项目目录下.git/config文件中最末添加
[user]
name = liming
email = [email protected]
用于指定本项目提交的用户名和邮箱
或者使用命令方式局部配置:
# 局部配置
git config user.name "Your Name"
git config user.email "[email protected]"
在指定项目目录下执行该命令
全局配置:
#设置全局配置
git config –global user.name "Your Name"
git config –global user.email "[email protected]"
#取消全局配置
git config --global --unset user.name
git config --global --unset user.email
# 查看局部配置
git config --list
#查看验证git账户
git config user.name
git config user.email
附件
https://github.com/fncheng/Error/issues/1
Git报错: FATAL: Unable to connect to relay host, errno=10061