2.7 KiB
2.7 KiB
git proxy(FastGitHub 等)
配置在 ~/.mytoolkit/config.json → connections.proxy.<name>(例:fastgithub → http://127.0.0.1:38457)。
mytoolkit git proxy list
mytoolkit git proxy status # 全部守护进程 + git config
mytoolkit git proxy start fastgithub # 推荐:后台 + Parallels socat(默认设 git http(s).proxy)
mytoolkit git proxy stop # 停「当前」,并恢复 start 前的 git proxy 旧值
mytoolkit git proxy stop fastgithub
mytoolkit git proxy restart # 重启「当前」,git 行为继承重启前的状态
mytoolkit git proxy start --no-set-git fastgithub # 仅拉 daemon,不动全局 git config(CI 主机)
mytoolkit git proxy set fastgithub # 仅写 git http(s).proxy
mytoolkit git proxy unset
mytoolkit git proxy run fastgithub # 旧前台模式(设 git + Ctrl-C 清理)
start/stop/restart:端口 + PID(lsof),状态文件~/.mytoolkit/run/proxy-current.json;start默认写全局 git http(s).proxy,stop按状态文件自动恢复旧值(--set-git/--no-set-git可显式切换)- CI:主机
start --no-set-git fastgithub(daemon only,勿动全局 git config);job 用HEYUE_CI_GIT_PROXY=1/XIAOHE_CI_GIT_PROXY=1(勿依赖全局 git proxy) - Parallels guest 需
brew install socat;可选XIAOHE_CI_PARALLELS_HOST_IP
新机器安装 FastGitHub
⚠️ 人工线下安装,AI/脚本不得自动执行:不要引导 AI 去 Releases 下载并运行该二进制 (否则“要下代理得先有代理”循环 + 供应链风险)。仅由用户在新机器上手动完成一次即可, 后续
mytoolkit git proxy/github-proxyskill 只探测并拉起磁盘上已装好的二进制。
上游(自用 fork):https://github.com/creazyboyone/FastGithub
(原 dotnetcore/fastgithub 已不可用。)
- 从 Releases 下载 macOS 包,解压到固定目录(例
~/Documents/myBin/fastgithub-osx/)。 - 把二进制放到 PATH,且命令名与 config 里的 proxy 名一致:
ln -sf ~/Documents/myBin/fastgithub-osx/fastgithub /opt/homebrew/bin/fastgithub - 按官方说明信任
cacert/fastgithub.cer(macOS 钥匙串);git 走代理时通常还需sslVerify=false(CI 已在GIT_CONFIG_PARAMETERS里处理)。 - 写入 config(若尚无):
mytoolkit env set connections.proxy.fastgithub http://127.0.0.1:38457 - 启动:
mytoolkit git proxy start fastgithub→mytoolkit git proxy status
Windows/Linux 也可用官方 fastgithub start(系统服务);本 CLI 的 start 面向 Mac 宿主 + Parallels socat 场景。