跳转至

抽风的Git

一、现象🐟

代码提交时出现ssh: connect to host ssh.github.com port 443: Connection refused错误

二、解决🐟

1.换回22端口-无用🐟

~/.ssh/config文件中的

Host github.com
Hostname ssh.github.com
PreferredAuthentications pulickey
IdentityFile ~/.ssh/id_rsa
Port 443
去掉

2.指定使用https仓库-无用🐟

vim shafishcn/.git/config,将url = git@github.com:shafishcn/shafish_blog.git改成url = https://github.com/shafishcn/shafish_blog.git

3.重新配置ssh key-发现问题🐟

ssh -vT git@github.com命令显示访问的ssh.github.com ip是本地的?????

shafish.cn[edit*] % ssh -vT git@github.com
OpenSSH_9.0p1, OpenSSL 1.1.1o  3 May 2022
debug1: Reading configuration data /home/shafish/.ssh/config
debug1: /home/shafish/.ssh/config line 39: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to ssh.github.com [::1] port 443.
debug1: connect to address ::1 port 443: Connection refused
debug1: Connecting to ssh.github.com [127.0.0.1] port 443.
debug1: connect to address 127.0.0.1 port 443: Connection refused
ssh: connect to host ssh.github.com port 443: Connection refused

4.修改本地的DNS解析-没试🐟

网上说出现这种问题大多是DNS解析被污染或者是代理问题

5.直接用代理-亲测有效随便加加攻速🐟

  • https
    git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
    #取消代理
    git config --global --unset http.https://github.com.proxy)
    
  • ssh vim ~/.ssh/config
    Host github.com
    ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p
    
    sudo pacman -S openbsd-netcat

ref:https://gist.github.com/laispace/666dd7b27e9116faece6


创建日期: June 1, 2022 00:19:38
最后更新: June 7, 2022 00:18:49