Skip to content

Instantly share code, notes, and snippets.

@Deali-Axy
Created January 17, 2024 15:54
Show Gist options
  • Save Deali-Axy/9516b2eca32d7c12facd91117539b131 to your computer and use it in GitHub Desktop.
Save Deali-Axy/9516b2eca32d7c12facd91117539b131 to your computer and use it in GitHub Desktop.
Windows 下的 git 代理配置

Windows 下的 git 代理配置

经过不断的尝试,我找到找到了属于我的正确配置方法

Host github.com
  User git
  Port 443
  Hostname ssh.github.com
  IdentityFile "C:\Users\用户名\.ssh\id_rsa"
  TCPKeepAlive yes
  ProxyCommand "C:\Users\用户名\scoop\apps\git\current\mingw64\bin\connect.exe" -S 127.0.0.1:7890 -a none %h %p

Host ssh.github.com
  User git
  Port 443
  Hostname ssh.github.com
  IdentityFile "C:\Users\用户名\.ssh\id_rsa"
  TCPKeepAlive yes
  ProxyCommand "C:\Users\用户名\scoop\apps\git\current\mingw64\bin\connect.exe" -S 127.0.0.1:7890 -a none %h %p

使用 ssh 命令测试没问题,实际使用也正常了

$ ssh -T [email protected]
Hi Deali-Axy! You've successfully authenticated, but GitHub does not provide shell access.
@Deali-Axy
Copy link
Author

如果出现路径错误的问题,可以换成 mingw64 里的路径

ProxyCommand /c/Users/用户名/scoop/apps/git/current/mingw64/bin/connect.exe  -S 127.0.0.1:7890 -a none %h %p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment