SourceTreeでGitを更新したらエラーになった

Windows版のSourceTreeでGitのバージョンを更新したら、Gitのエラーが出た。


'git log' がコード128で終了しました: fatal; unsafe repository
(xxxxxxxxx is owned by someone else)

To add an exception for this directory, call:

git config --global --add safe.directory

エラーの最後の部分には、NASのパスが書いてあった。

これは、git 2.35.2から実装されたセキュリティ対策が影響しているらしく、
NAS上のGitリポジトリは「unsafe repository」ということらしい。

LANにある自分専用のNASなので、許可ディレクトリに追加して対処。

WindowsのSourceTreeなので、%UserProfile%\.gitconfig へ以下を追記した。

[safe]
        directory = 許可したいpath