Repository navigation
v0.2.0 — 修掉 git 凭据助手弹窗
Pre-release
Pre-release
修一个反复打扰人的小东西:Windows 上每次 git 要凭据,都弹一个 Select a credential helper(CredentialHelperSelector)。
成因
git config --system --get-all credential.helper # → helper-selector
git config --global --get credential.credentialStore # → 空helper-selector 这个 helper 的职责就是弹选择框;同时 credentialStore 没配,GCM 不知道往哪存 —— 于是一次次问。
还有一个容易踩的点:credential.helper 是多层叠加的(system → global → local),在 global 里写一条 manager 顶不掉 system 里的 helper-selector,必须先在 global 写一条空值重置列表。
修法
git config --global credential.credentialStore wincred
git config --global --unset-all credential.helper
git config --global --add credential.helper "" # 空值 = 重置此前累积的清单
git config --global --add credential.helper manager修完各层长这样:
system : helper-selector ← 还在,但被下面重置掉了
global : (空) ← 重置
global : manager ← 实际生效
插件里怎么做
新增工具 github_fix_git_auth:
github_fix_git_auth({}) // 只检查,报告现状
github_fix_git_auth({ apply: true }) // 写 ~/.gitconfig 修掉或者打开 设置 → GitHub,卡片「git 凭据弹窗」里点 修复(写 ~/.gitconfig),状态行会显示当前 helper / store 和是否会弹。
边界
- 只改 git 自己的凭据存储配置,不读取、不修改、不打印你的 GitHub token
- store 按平台选:Windows
wincred、macOSosxkeychain、Linuxsecretservice - 第一次用仍会让你输入一次账号/token(之后按 store 记住),但不会再弹选择框
- 只动
~/.gitconfig,不碰 system 配置(那需要管理员,而且会被程序更新覆盖)
安装 / 升级
dsh plugin --profile <你的 profile> remove dsh-github
dsh plugin --profile <你的 profile> add "file:<下载路径>/dsh-github-0.2.0.tgz"校验:同页 SHA256SUMS.txt。冒烟测试 23 项(新增 4 项覆盖 git-auth 路由与新工具)。