目前国内访问 Github 基本上是不可用状态,请问有没有比较合适的解决办法?

2022-12-12 11:53:14 +08:00
 azusachino
  1. Github 不单单是代码管理,更多的可能是作为社区,或者说,个人简历一样的功能,所以肯定是不能割舍的;
  2. 本地也尝试了使用 socks.proxy 这样的代理模式,但是感觉效果不是很好,git push 还是失效的;

麻烦大佬指指路,谢谢。

4467 次点击
所在节点    GitHub
28 条回复
kyric
2022-12-12 12:07:13 +08:00
在 git config 里面设置本地 socks 的代理就可以了
cvbnt
2022-12-12 12:12:52 +08:00
clash tun
muzihuaner
2022-12-12 12:13:35 +08:00
Steam++
libook
2022-12-12 12:14:13 +08:00
我记得 git 好像用的是 curl ,是支持环境变量配置代理的,可以参考我这个工具箱的代码,亲测有效
https://github.com/libook/IdleBox/blob/master/zshrcs/public/shell-proxy

根据之前踩过的坑,不同的程序可能对环境变量的大小写敏感,所以我这个里面大小写全都 export 。
Dvel
2022-12-12 12:24:16 +08:00
我是这么搞的。

~/.zshrc 开启 http 代理:
export https_proxy=http://127.0.0.1:6152
export http_proxy=http://127.0.0.1:6152
export all_proxy=socks5://127.0.0.1:6153

再在 ~/.ssh/config 开启 ssh 代理:
Host *
ProxyCommand nc -X 5 -x 127.0.0.1:6153 %h %p


或者直接增强模式。
hsfzxjy
2022-12-12 12:25:17 +08:00
proxychains 一把梭
Hurriance
2022-12-12 12:27:40 +08:00
我用过第二种,没有失效的情况,可以检查下是不是其他问题
bipy
2022-12-12 12:47:14 +08:00
git 两种模式:SSH 、HTTP
proxy 两种模式:SOCKS 、HTTP

两两组合,共 4 种设置,请按需正确配置:

# 1. git http + proxy http
git config --global http.proxy "http://127.0.0.1:1080"
git config --global https.proxy "http://127.0.0.1:1080"

# 2. git http + proxy socks
git config --global http.proxy "socks5://127.0.0.1:1080"
git config --global https.proxy "socks5://127.0.0.1:1080"

# to unset
git config --global --unset http.proxy
git config --global --unset https.proxy

# 3. git ssh + proxy http
vim ~/.ssh/config
Host github.com
HostName github.com
User git
ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=1087

# 4. git ssh + proxy socks
vim ~/.ssh/config
Host github.com
HostName github.com
User git
ProxyCommand nc -v -x 127.0.0.1:1080 %h %p
arischow
2022-12-12 12:49:29 +08:00
0. 能不能路由层翻墙?
1. 能不能用网关模式 (Surge)? Clash 应该叫 TUN 模式
yfugibr
2022-12-12 12:58:40 +08:00
Clash 或 Clash.Meta 的 tun 模式很方便
另外很多机场会屏蔽 22 端口,可以走 443 端口的 ssh
官方文档 https://docs.github.com/en/authentication/troubleshooting-ssh/using-ssh-over-the-https-port
herozzm
2022-12-12 13:01:28 +08:00
host 大法?
52acca
2022-12-12 13:15:42 +08:00
路由器透明代理比较完美
waiaan
2022-12-12 14:06:47 +08:00
lambdaq
2022-12-12 14:11:19 +08:00
上一次 github 被封,还是 李开复 在微博上号召大家投诉工信部才解决的。
20210610204811
2022-12-12 14:32:04 +08:00
dguge
2022-12-12 15:04:11 +08:00
换成 gitee 或 coding
wdssmq
2022-12-12 15:12:25 +08:00
Windows 下 SSH 走代理可以这样,socks 协议

Host github.com
User git
ProxyCommand "C:\Program Files\Git\mingw64\bin\connect.exe" -S 127.0.0.1:10808 %h %p
GeruzoniAnsasu
2022-12-12 15:15:31 +08:00
proxychains 一把梭 +1
dzdh
2022-12-12 15:16:31 +08:00
自建 gitea 吧
yoa1q7y
2022-12-12 15:18:24 +08:00
路由器翻,对墙完全无感

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/901895

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX