From c5dc63dfbe6dd908d0b97cf8b40f113d5a2ac626 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Claude=20=28=E6=9C=AC=E6=A9=9F=E7=B8=BD=E7=AE=A1=29?= Date: Sat, 18 Jul 2026 22:41:07 +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?= 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