git_push.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. # ============================================================================
  3. # Git 初始化并推送到 Gogs 仓库
  4. # 仓库地址: https://git.zhonjin.com:40717/steven_roc/nginx-stream-ssl-preread
  5. # ============================================================================
  6. set -e
  7. GREEN='\033[0;32m'
  8. YELLOW='\033[1;33m'
  9. NC='\033[0m'
  10. echo -e "${GREEN}=== Git 仓库初始化与推送 ===${NC}"
  11. # 1. 配置 Git
  12. git config user.name "steven_roc" 2>/dev/null || true
  13. git config user.email "steven_roc@zhonjin.com" 2>/dev/null || true
  14. # 2. 初始化 Git 仓库
  15. if [ ! -d .git ]; then
  16. git init
  17. echo -e "${GREEN}[✓] Git 仓库已初始化${NC}"
  18. else
  19. echo -e "${YELLOW}[i] Git 仓库已存在,跳过初始化${NC}"
  20. fi
  21. # 3. 添加远程仓库
  22. REMOTE_URL="https://steven_roc:1942ce3d6478f7a572fee3dd4891e49f6c416aad@git.zhonjin.com:40717/steven_roc/nginx-stream-ssl-preread.git"
  23. git remote get-url origin 2>/dev/null && git remote remove origin
  24. git remote add origin "$REMOTE_URL"
  25. echo -e "${GREEN}[✓] 远程仓库已配置${NC}"
  26. # 4. 添加所有文件
  27. git add -A
  28. echo -e "${GREEN}[✓] 文件已添加到暂存区${NC}"
  29. # 5. 提交
  30. git commit -m "feat: Nginx Stream + SSL Preread 多子域名自动分流方案 v2.0
  31. 架构: TCP 层 ssl_preread 协议检测 + 模块化配置文件
  32. 端口映射:
  33. - 40130 chanking.zhonjin.com → 127.0.0.1:5004 (主 Web 服务)
  34. - 40715 mqtt.zhonjin.com → 127.0.0.1:8085 (MQTT 服务)
  35. - 40716 baolin.zhonjin.com → 127.0.0.1:5000 (宝林服务 A)
  36. - 40719 baolin.zhonjin.com → 127.0.0.1:5001 (宝林服务 B)
  37. 配置文件:
  38. - nginx.conf: 主配置(40130 + include 指令)
  39. - zhonjin_http.conf: 子域名 HTTP 服务配置
  40. - zhonjin_stream.conf: 子域名 Stream 分流配置
  41. - zhonjin.com.conf: 配置总览说明
  42. 文档:
  43. - CHANGELOG.md: 变更日志
  44. - TECH_DOC.md: 完整技术方案
  45. - RASPBERRYPI_SETUP.md: 树莓派 5 部署指南
  46. - QA_ARCHIVE.md: 问答归档"
  47. echo -e "${GREEN}[✓] 已提交${NC}"
  48. # 6. 推送
  49. git branch -M main
  50. git push -u origin main --force
  51. echo -e "${GREEN}[✓] 已推送到 Gogs 仓库${NC}"
  52. echo ""
  53. echo -e "${GREEN}=== 推送完成 ===${NC}"
  54. echo -e "仓库地址: https://git.zhonjin.com:40717/steven_roc/nginx-stream-ssl-preread"
  55. echo ""
  56. echo -e "${YELLOW}安全提示: 推送完成后建议从 .git/config 中移除 token,${NC}"
  57. echo -e "${YELLOW}改用 git credential 或 SSH key 管理认证。${NC}"