From 14d4d658482c809d57a5a06f003efee1e0573270 Mon Sep 17 00:00:00 2001 From: uncle6me-web Date: Sat, 18 Jul 2026 22:41:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(publish):=20push=20=E6=86=91=E8=AD=89?= =?UTF-8?q?=E6=94=B9=20header=20=E6=B3=A8=E5=85=A5(GITHUB=5FMIRROR=5FTOKEN?= =?UTF-8?q?=20env),token=20=E4=B8=8D=E9=80=B2=20URL/=E6=8C=87=E4=BB=A4?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/publish-github.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/publish-github.sh b/scripts/publish-github.sh index 7085a8f..9fcab17 100755 --- a/scripts/publish-github.sh +++ b/scripts/publish-github.sh @@ -62,6 +62,12 @@ if [ "${1:-}" = "--push" ]; then fi git remote remove github 2>/dev/null || true git remote add github "$GITHUB_REMOTE" - git push -u github main + # 憑證不進 URL/指令行:有 GITHUB_MIRROR_TOKEN 就用 Basic header 注入(PAT) + if [ -n "${GITHUB_MIRROR_TOKEN:-}" ]; then + AUTH_B64="$(printf '%s:%s' "${GITHUB_ACCOUNT_NAME:-git}" "$GITHUB_MIRROR_TOKEN" | base64 | tr -d '\n')" + git -c http."$GITHUB_REMOTE".extraheader="Authorization: Basic $AUTH_B64" push -u github main + else + git push -u github main + fi echo "🚀 已 push → $GITHUB_REMOTE" fi