3

设置git ssh代理

 7 months ago
source link: https://bajie.dev/posts/20240117-git_proxy/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

设置git Ssh代理

2024-01-17 1 分钟阅读

万万没想到啊,github被封轮到自己头上了。

这个博客是在windows下用Typora写的,然后hugo生成,直接用git for windows提交,今天git无法提交了。

image-20240117180143368

必须设置一下git ssh的代理了,我用的是socks5。

C:\Users\username\.ssh\config文件中添加相关配置,如果没有config文件需要手动创建,connect命令是git Windows客户端git for windows自带的, 位于<Git-install-path>\mingw64\bin\connect.exe

  • socks代理添加以下配置

    Host github.com(改成你的站点)
    ProxyCommand connect -S 127.0.0.1:1080 %h %p
    

可以配置多个网站Host

Host github.com(改成你的站点)
ProxyCommand connect -S 127.0.0.1:1080 %h %p

Host bitbucket.org(改成你的站点)
ProxyCommand connect -S 127.0.0.1:1080 %h %p

如果Host设置为*,代理会对所有未配置的Host起作用。以下有三项配置,访问github使用第二项配置,访问bitbucket使用第三项配置,其它网站使用第一项配置

Host *
    ProxyCommand "C:/Program Files/Git/mingw64/bin/connect.exe" -H 127.0.0.1:1080 %h %p
    IdentityFile "C:/Users/bybon/.ssh/id_rsa"
    TCPKeepAlive yes
    IdentitiesOnly yes

Host github.com
    ProxyCommand connect -S 127.0.0.1:1080 %h %p

Host bitbucket.com
    ProxyCommand connect -S 127.0.0.1:1080 %h %p

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK