身為 leo,我要 git push 不再把 token 印出來,我才不用每次都判斷要不要輪替金鑰 #47
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
現象
每一次
git push到 Gitea,git 都會印這一行:token 明文出現在輸出裡 ⇒ 進 transcript、進 log、進任何貼出去的畫面。2026-08-20 一天發生數次。
根因
remote URL 裡嵌著 token(
https://claude-code:<token>@git.uncle6.me/…)。只要它在,任何印出 remote URL 的訊息都會洩一次。為什麼今晚沒直接修
實測過乾淨網址可行(macOS keychain 供認證,來源
/Library/Developer/CommandLineTools/usr/share/git-core/gitconfig),但六個地方靠 remote URL 抽 token:InkStoneCo:system-dev/scripts/dispatch-agent.sh、.claude/hooks/factory-idle-guard.sh、scripts/wiki-panorama.shISEP:hooks/factory-idle-guard.sh、scripts/gitea-labels-sync.sh、scripts/wiki-panorama.sh拿掉 token 後這六個會靜默拿到空字串 → 401,而依 2026-08-13 的教訓那會被讀成「找不到/不存在」。半夜動一支 hook 風險不對稱,所以還原了。
這是記錄下來的假設,不是提問:修法應該是把 token 來源統一到
.env(GITEA_TOKEN_CLAUDE_CODE,credentials-map.md已收錄),六處改成同一支共用 lookup,然後 remote URL 才能改乾淨。驗收
.envgit push的輸出裡沒有任何 token 字樣順帶
claude-code這把 token 今天已在 transcript 裡明文出現多次,要不要輪替是 leo 的決定。