赞
踩
发现今天开始github的ssh都被屏蔽了,导致git命令没法用,之前只是屏蔽了https而已,唉。
检查是否有安装connect
$bash: connect
connect --- simple relaying command via proxy.
Version 1.101
usage: connect [-dnhst45] [-p local-port][-R resolve] [-w timeout]
[-H proxy-server[:port]] [-S [user@]socks-server[:port]]
[-T proxy-server[:port]]
[-c telnet-proxy-command]
host port
如提示没有则进行安装
sudo apt update -y
sudo apt install connect-proxy
如果update后install还是提示找不到connect-proxy包,检查系统软件源
vim /etc/apt/sources.list
若没有可使用清华或阿里云之类的镜像,复制内容写入即可
https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
创建ssh配置文件
vim ~/.ssh/config
配置文件中写入以下内容,ProxyCommand 中的代理地址 localhost:1080 根据实际情况修改
Host github.com
User xxx@email.com
Port 22
HostName github.com
IdentityFile "~/.ssh/id_rsa"
TCPKeepAlive yes
ProxyCommand connect -S localhost:1080 -a none %h %p
Host ssh.github.com
User xxx@email.com
Port 443
HostName ssh.github.com
IdentityFile "~/.ssh/id_rsa"
TCPKeepAlive yes
ProxyCommand connect -S localhost:1080 -a none %h %p
开启代理,git pull一下,完毕。
windows用户的IdentityFile可能位于 C:/Users/<用户名>/.ssh/id_rsa
wsl2用户可以用cat /etc/resolv.conf |grep "nameserver" |cut -f 2 -d " "获取windows主机ip配置代理。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。