ネットワークフォルダに Git リポジトリを作成

Tech Knowledge
公開: 2024-10-28

はじめに

ネットワークフォルダにリポジトリがあると、以下のようなエラーが発生する場合がある

'git log' がコード 128 で終了しました: fatal: detected dubious ownership in repository at '//server123/hoge/repo'
'//server123/hoge/repo' is owned by:
	'S-1-5-32-544'
but the current user is:
	'S-1-5-21-513713162-3993655636-169061624-1001'
To add an exception for this directory, call:

	git config --global --add safe.directory '%(prefix)///server123/hoge/repo'
 (\\server123\hoge\repo)

解決策

エラーメッセージに表示されているように「git config --global --add safe.directory」を使用して、ネットワークフォルダを信頼させる。

git config --global --add safe.directory '%(prefix)///server123/hoge/repo'