在.ssh目录新建config
#Windows用户,注意替换你的端口号和connect.exe的路径 ProxyCommand "C:\Program Files\Git\mingw64\bin\connect" -S 127.0.0.1:7890 -a none %h %p #MacOS用户用下方这条命令,注意替换你的端口号 #ProxyCommand nc -v -x 127.0.0.1:51837 %h %p Host github.com User git Port 22 Hostname github.com TCPKeepAlive yes Host ssh.github.com User git Port 443 Hostname ssh.github.com TCPKeepAlive yes