#!/usr/bin/env bash # 推送到 Gitea: https://gitea.yuxindazhineng.com/whm/web set -e cd "$(dirname "$0")" GITEA_URL="https://gitea.yuxindazhineng.com/whm/web.git" if [ ! -d .git ]; then echo "初始化 Git 仓库..." git init git branch -M main fi if ! git remote get-url origin 2>/dev/null; then echo "添加远程: $GITEA_URL" git remote add origin "$GITEA_URL" else git remote set-url origin "$GITEA_URL" fi echo "添加并提交..." git add . if [ -n "$(git status --porcelain)" ]; then git commit -m "chore: push to gitea (yh_web)" else echo "无新变更" fi echo "推送到 origin..." git push -u origin main || git push -u origin main --force echo "完成: https://gitea.yuxindazhineng.com/whm/web"