发布于 2022-04-13 14:19:39
我现在所做的,但可能不是一个完美的解决方案,就是找到所有的.git
文件夹,并通过一个find
命令添加它们。
find /full/path -name '.git' -type d -exec bash -c 'git config --global --add safe.directory ${0%/.git}' {} \;
希望提醒您,在find命令中添加完整路径是必要的,因此它将解析完整路径。
发布于 2022-04-20 17:23:02
在Git 2.36中,您还可以将*表示'all‘添加到safe.directory中。它并不像您所要求的那样是递归的,但是根据您的情况,它可能会有所帮助。
git config --global --add safe.directory *
请参阅https://github.blog/2022-04-18-highlights-from-git-2-36/和搜索safe.directory。
https://stackoverflow.com/questions/71855882
复制相似问题