双项目 Smart Push v3.0 部署总结
✓ 部署完成
日期: 2026-03-29 版本: v3.0 状态: ✅ 全部项目就绪
已部署项目
1. 智能知识系统
| 项目 | 路径 | 远程仓库 |
|---|---|---|
| 智能知识系统 | /home/ai/zhineng-knowledge-system |
GitHub + Gitea |
| LingFlow | /home/ai/LingFlow |
GitHub + Gitea |
2. 共享配置
| 资源 | 路径 | 说明 |
|---|---|---|
| 全局 Hooks | ~/.git-hooks/smart-push |
所有项目共享 |
| Clash 配置 | ~/.config/clash/ |
代理服务配置 |
| Git 全局配置 | ~/.gitconfig |
core.hooksPath |
功能对比
| 功能 | 智能知识系统 | LingFlow | 状态 |
|---|---|---|---|
| 智能网络检测 | ✅ | ✅ | 双项目支持 |
| 自动代理切换 | ✅ | ✅ | 共享 Clash |
| 双仓库推送 | ✅ | ✅ | GitHub + Gitea |
| 自动重试 | ✅ | ✅ | 2次重试 |
| 性能监控 | ✅ | ✅ | DEBUG 模式 |
| SSH/HTTPS | ✅ | ✅ | 双协议支持 |
使用方式
智能知识系统
LingFlow
统一命令(任何项目)
# 推送当前分支
~/.git-hooks/smart-push
# 调试模式
DEBUG=1 ~/.git-hooks/smart-push
# 推送到指定远程
~/.git-hooks/smart-push github
性能测试结果
网络连接质量
| 项目 | GitHub 直连 | Gitea 直连 | Clash 代理 |
|---|---|---|---|
| 智能知识系统 | 0.298s | N/A | 0.565s |
| LingFlow | 0.301s | ~0.1s | ~0.6s |
推送性能
| 操作 | 平均耗时 | 状态 |
|---|---|---|
| 单仓库直连 | ~2s | ✅ 优秀 |
| 双仓库推送 | ~5s | ✅ 良好 |
| 代理推送 | ~3s | ✅ 可用 |
配置文件
项目配置文件
/home/ai/zhineng-knowledge-system/
├── SMART_PUSH_V3_REPORT.md # 技术报告
├── SMART_PUSH_GUIDE.md # 使用指南
└── .git/hooks/smart-push # 项目本地 Hook
/home/ai/LingFlow/
├── SMART_PUSH_LINGFLOW_SETUP.md # LingFlow 专用文档
├── SMART_PUSH_V3_REPORT.md # 技术报告
├── SMART_PUSH_GUIDE.md # 使用指南
└── .git/hooks/smart-push # 项目本地 Hook
全局配置文件
~/.git-hooks/
└── smart-push # 主脚本(所有项目共享)
~/.config/clash/
├── clash # Clash 可执行文件
├── config.yaml # 配置文件
└── config.yml # 完整配置
~/.gitconfig
└── core.hooksPath = ~/.git-hooks # 全局 Hooks 路径
快捷命令
Bash Alias(推荐添加到 ~/.bashrc)
# Smart Push 快捷方式
alias sp='~/.git-hooks/smart-push'
alias sp-debug='DEBUG=1 ~/.git-hooks/smart-push'
alias sp-both='~/.git-hooks/smart-push github origin'
alias sp-gh='~/.git-hooks/smart-push github'
alias sp-gt='~/.git-hooks/smart-push gitea'
# 项目快捷方式
alias zk-cd='cd /home/ai/zhineng-knowledge-system'
alias lf-cd='cd /home/ai/LingFlow'
alias zk-push='cd /home/ai/zhineng-knowledge-system && ~/.git-hooks/smart-push github gitea'
alias lf-push='cd /home/ai/LingFlow && ~/.git-hooks/smart-push github origin'
使用示例
# 通用推送
sp # 当前分支智能推送
sp-debug # 调试模式推送
sp-both # 双仓库推送
# 项目推送
zk-push # 智能知识系统双仓库推送
lf-push # LingFlow 双仓库推送
集成方案
方案1: 使用全局 Hooks(推荐)
所有项目自动使用 ~/.git-hooks/smart-push
优点: - 统一管理,自动更新 - 所有 Git 仓库可用 - 无需额外配置
使用:
方案2: 项目本地 Hooks
每个项目使用自己的 .git/hooks/smart-push
优点: - 项目独立配置 - 可定制化
缺点: - 需要手动同步更新
方案3: 混合方案(当前部署)
- 全局 Hooks: 默认配置
- 项目 Hooks: 项目特定配置
工作流程对比
传统 git push
Smart Push v3.0
优势: - ✅ 减少手动操作 - ✅ 自动处理网络问题 - ✅ 统一的使用体验 - ✅ 详细的性能反馈
监控和调试
查看代理状态
测试网络连接
# GitHub
time curl -I https://github.com
# Gitea
time curl -I http://zhinenggitea.iepose.cn
# 通过代理
time curl -x http://127.0.0.1:7890 -I https://github.com
清理 Git 代理
扩展性
添加新项目
# 1. 复制 Hook
cp ~/.git-hooks/smart-push /path/to/new-project/.git/hooks/
# 2. 测试
cd /path/to/new-project
~/.git-hooks/smart-push --help
# 3. 配置远程(如需要)
git remote add github <github-url>
git remote add gitea <gitea-url>
添加更多代理
编辑 ~/.git-hooks/smart-push,在 PROXY_LIST 中添加:
PROXY_LIST=(
"clash|http://127.0.0.1:7890"
"proxy1|http://proxy.example.com:8080"
"proxy2|socks5://127.0.0.1:1080"
)
故障排查
常见问题
Q: smart-push 命令不存在
# 方案1: 使用完整路径
~/.git-hooks/smart-push
# 方案2: 配置 alias
git config alias.sp "!~/.git-hooks/smart-push"
# 方案3: 添加到 PATH
export PATH="$HOME/.git-hooks:$PATH"
Q: Clash 启动失败
# 检查 Clash 文件
ls -la ~/.config/clash/clash
# 手动测试
~/.config/clash/clash -d ~/.config/clash
# 查看错误
cat /tmp/clash_smart_push.log
Q: 推送失败
版本信息
| 组件 | 版本 |
|---|---|
| Smart Push | v3.0 |
| Clash | v1.x |
| Git | 2.x |
| 部署日期 | 2026-03-29 |
总结
✅ 双项目部署成功
- 智能知识系统和 LingFlow 项目都已部署
- 共享全局 Hooks 配置
- 统一的使用体验
- 自动化网络处理
下一步建议: 1. 添加快捷命令到 ~/.bashrc 2. 配置更多代理备选(如需要) 3. 监控推送性能和成功率 4. 根据使用情况优化配置
维护: 可通过更新 ~/.git-hooks/smart-push 统一升级所有项目。
文档生成时间: 2026-03-29 状态: ✅ 就绪可用