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