报错:fatal: detected dubious ownership in repository at 'D:/Coxxx' 'D:/Coxx' is owned by: (inconvertible) (S-xxxx) but the current user is: xxx/1xx (S-xxyy) To add an exception for this directory, call: git config --global --add safe.directory D:/Coxx bash: https://github.com/xx.git: No such file or directory
背景:电脑重置过,且有多个项目可能都会遇到该问题
这个错误是由于Git检测到仓库目录的所有权与当前用户不匹配导致的。错误分为两部分:
所有权问题:
Git发现仓库目录 'D:/Coxx' 的所有者ID (S-xxxx) 与当前用户 xxx/1xx (S-xxyy) 不匹配
这是Git的安全机制,防止潜在的安全风险
重置电脑后,用户 SID (Security Identifier) 发生变化,但旧项目的文件仍保留原用户的所有权信息<