梗概:

在22年4月之后, git更新了安全策略, git提交前需要信任该git仓库, 否则会报错:

fatal: unsafe repository(xxx is owned by someone else.)
To add an exception for this directory, call git config –global –add safe.directory

解决方案:

1. 方法之一: 用到那个仓库, 就信任那个仓库

git config --global --add safe.directory 目录

2. 方法之一: 信任所有仓库

git config --global --add safe.directory "*"