git config --global --add safe.directory "*"
请查看https://github.blog/2022-04-18-highlights-from-git-2-36/并搜索safe.directory。
编辑:根据zcoop98的建议,我们应该在'*'周围添加双引号。
find
命令查找所有的 .git
文件夹,并将它们添加进去。find /full/path -name '.git' -type d -exec bash -c 'git config --global --add safe.directory ${0%/.git}' {} \;
提醒大家:在使用查找命令时,需要添加完整路径,这样才能解析出完整路径。
参数数量错误,应该是2个
。 - Kunal Tyagi*
放在单引号'*'
或双引号"*"
中。 - zcoop98