Commit 6538a8b7 authored by wenwen.tang's avatar wenwen.tang 😕

docs: 补齐凭据锁问题根因与本地修复方式

parent 66561978
Pipeline #833 canceled with stages
......@@ -32,11 +32,23 @@
- 验证:索引 LF / 工作区 CRLF 时 `git status` 依然干净(走归一化比较),**不会产生假 diff** ——
这点很关键,因为台账会被程序频繁写入
### 一个副作用修复
### 一个副作用修复(根因已定位)
- `git push -u` 报 `could not lock config file …/PortableGit/etc/gitconfig: File exists`
- 定位:`etc/gitconfig.lock` 是 0 字节残留锁(时间戳正好是推送那一刻);确认无进程持有后清除,
`git fetch` 恢复正常。**该锁会持续干扰后续所有写系统配置的 git 操作**
- 现象:**只要需要向服务器认证就复现**;空 push(`Everything up-to-date`)不报错
- 根因:本机 git 的 **系统级 `credential.helper=helper-selector`**(WorkBuddy 定制选择器)。
它在认证成功后要去写系统 `gitconfig` 记录所选 helper,写入失败却留下 0 字节 `gitconfig.lock`,
并**持续干扰**后续所有写系统配置的 git 操作
- 它还会顺带改写 `~/.gitconfig`:把 `credential.helper=store` 换成 `git-credential-wincred.exe`
并追加 `[credential "helperselector"] selected = <no helper>` —— 属其正常机制,未损坏配置
- **修复(已生效)**:在**仓库本地**重置凭据链,绕过选择器
```bash
git config --local credential.helper "" # 空值 = 清空此前累加的 helper 链
git config --local --add credential.helper store
```
验证:`git ls-remote`(需认证)正常且 **`gitconfig.lock` 不再生成** ✓
- 该设置只落在 `.git/config`,不影响其他项目,也不动系统/全局配置
- 若将来 store 凭据失效需重新认证:`git config --local --unset-all credential.helper` 即可还原
### 完整性验证(clone 回环)
......
......@@ -209,6 +209,9 @@
`.gitattributes` 优先级高于 autocrlf,故跨机行为一致
- **Dockerfile 必须 LF** —— 续行符 `\` 带 `\r` 会让 Linux 构建解析错误
- 台账索引 LF / 工作区 CRLF,靠归一化保证 `git status` 干净,**不会假 diff**(程序频繁写台账也不受影响)
- **本机 git 坑(已修)**:系统级 `credential.helper=helper-selector`(WorkBuddy 定制)在每次认证后会去写
系统 gitconfig,失败则留下 0 字节 `gitconfig.lock` 并反复报错。已在仓库本地绕过:
`git config --local credential.helper ""` + `--add credential.helper store`(只影响本仓库)
## 验证脚本(tools/)
`test_rules.py` `test_scheduler.py` `test_directory.py` `test_rent.py` `test_round5.py`(单元测试,全量 **147 项**)/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment