From ee7fc96cb36cc24c85487afc2a2d3935888d3540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A1=E8=8B=A5?= Date: Mon, 16 Mar 2026 14:50:57 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BB=A5=E6=9C=AC=E5=9C=B0=E4=B8=BA?= =?UTF-8?q?=E5=87=86=EF=BC=8C=E4=B8=8A=E4=BC=A0=E5=85=A8=E9=83=A8=E5=B9=B6?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=20GitHub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/push-to-github.sh | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/scripts/push-to-github.sh b/scripts/push-to-github.sh index 0e49015..5c2a98e 100644 --- a/scripts/push-to-github.sh +++ b/scripts/push-to-github.sh @@ -1,5 +1,5 @@ #!/bin/bash -# 以本地为准:上传本地全部文件,强制替换 GitHub 上 v0/fnvtk-5efaab9c(不拉取、不改本地) +# 以本地为准:上传本地全部文件到 GitHub 与 Gitea(不拉取、不改本地) # 在终端执行: bash scripts/push-to-github.sh set -e @@ -18,6 +18,9 @@ else echo "已从卡若AI 读取 Token" fi +GITEA_TOKEN="07f82fbd81a64fb714d9a6c47b11cc5b98f2fa2e" +GITEA_URL="http://fnvtk:${GITEA_TOKEN}@open.quwanzhi.com:3000/fnvtk/users.git" + echo "=== 1. 当前状态(本地分支) ===" git status echo "" @@ -36,10 +39,32 @@ else fi echo "" -echo "=== 4. 强制推送到 GitHub,覆盖 v0/fnvtk-5efaab9c ===" +echo "=== 4. 推送到 GitHub main ===" +git push "$PUSH_URL" HEAD:main +echo "" + +echo "=== 5. 强制推送到 GitHub v0/fnvtk-5efaab9c ===" # 当前分支(HEAD)覆盖远程 v0/fnvtk-5efaab9c,重叠处一律以本地为准 git push --force "$PUSH_URL" HEAD:v0/fnvtk-5efaab9c echo "" +echo "=== 6. 确保 Gitea 仓库存在 ===" +curl -u "fnvtk:zhiqun1984" -X POST "http://open.quwanzhi.com:3000/api/v1/user/repos" \ + -H "Content-Type: application/json" \ + -d '{"name":"users","description":"神射手 users 仓库","private":false}' || true +echo "" + +echo "=== 7. 配置并推送到 Gitea main ===" +if git remote get-url gitea >/dev/null 2>&1; then + git remote set-url gitea "$GITEA_URL" +else + git remote add gitea "$GITEA_URL" +fi +unset HTTP_PROXY HTTPS_PROXY ALL_PROXY +GIT_HTTP_VERSION=HTTP/1.1 git push -u gitea HEAD:main +echo "" + echo "=== 完成 ===" -echo "GitHub 已与本地一致: https://github.com/fnvtk/users/tree/v0/fnvtk-5efaab9c" +echo "GitHub main: https://github.com/fnvtk/users/tree/main" +echo "GitHub v0: https://github.com/fnvtk/users/tree/v0/fnvtk-5efaab9c" +echo "Gitea: http://open.quwanzhi.com:3000/fnvtk/users"