以下の内容はhttps://iww.hateblo.jp/entry/20250930/gitより取得しました。


gitで、detected dubious ownership というエラーが出たときの対処

Windows共有で 192.168.0.50/hoge を Oドライブに割り当てているとき
Oドライブ上のプロジェクトを SourceTreeで管理しようとしたらなんかエラーが出た

---------------------------
エラーが発生しました
---------------------------
'git status' がコード 128 で終了しました: fatal: detected dubious ownership in repository at '//192.168.0.50/hoge/project/unko'
'//192.168.0.50/hoge/project/unko' is owned by:
	(inconvertible) (S-1-5-21-661669772-8100564429-1481284421-1001)
but the current user is:
	THANOS/hoge (S-1-5-21-1403430234-1145147990-2930260477-1001)
To add an exception for this directory, call:

	git config --global --add safe.directory '%(prefix)///192.168.0.50/hoge/project/unko'
 (O:\project\unko)
---------------------------
OK   
---------------------------

ようするに O:\project\unko の所有者が信用できないという話なので
大丈夫ッス という設定を ~/.gitconfig にしなければならない

C:\Users\hoge\.config

[core]
	autocrlf = false
	safecrlf = true

[safe]
	bareRepository = explicit
	directory = *                  # ★すべてを信用する設定 追記
#	directory = //192.168.0.50/hoge/project/unko ; ★個別に許可するとき

※ directory = O:/project/unko とは書けない
※ %(prefix)/ は別に書かなくてもいい
※ * は「全てを赦す」という記号であってワイルドカードではない。//192.168.0.50/hoge/project/* みたいなのは書けない


stackoverflow.com




以上の内容はhttps://iww.hateblo.jp/entry/20250930/gitより取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14