Gitでローカルリポジトリからクローンに失敗(exit code 128)

この記事は約2分で読めます。
スポンサーリンク

やりたいこと

Windows環境のGitでローカルリポジトリからクローンしようとしたときにexit code 128で失敗したときの解決方法です。

詳細なエラーログは以下のものです。

git.exe clone --progress -v -- "F:\PATH" "F:\PATH"
Cloning into 'F:\PATH'...
fatal: detected dubious ownership in repository at 'F:\PATH'
'F:\PATH' is on a file system that does not record ownership
To add an exception for this directory, call:

git config --global --add safe.directory 'F:PATH'
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.


git did not exit cleanly (exit code 128) (828 ms @ 2024/10/20 16:26:10)

PATHおよび黒塗りのところにはローカルのリポジトリか、クローンしようとしたパスです。

スポンサーリンク

解決策

基本的に下の記事と同じです。

以下をリポジトリのフォルダ(source側)にbatとして保存してでダブルクリックで実行します。

(もう少し細かいことは上の記事を確認してください。)

set "current_dir=%~dp0"
set "m_dir=%current_dir:\=/%"
set "m_dir2=%m_dir:~0,-1%"

git config --global --add safe.directory %m_dir2%

pause
スポンサーリンク

結果

gitでクローンに失敗していたリポジトリからクローン出来るようになりました。

コメント

タイトルとURLをコピーしました