Failed to install Extension from URL(Stable Diffusion)

This article can be read in about 4 minutes.
PR

The purpose 

This is a countermeasure for when you encounter the following error and fail to install an extension from a URL in Stable Diffusion.

GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git fetch -v -- origin stderr: 'fatal: detected dubious ownership in repository at 'path for temp folder''

The “path for temp folder” contains the path to your working directory.

PR

Countermeasures


Open the working folder shown in the error using File Explorer.

Create a new batch file with any name (e.g., add_safedir.bat).

Open the created batch file with Notepad or a similar text editor, paste the following batch commands, and save it.


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

Double-click the created .bat file to run it.

Once it’s finished, close the command prompt that appeared.

Navigate to the parent folder of your working directory and delete the working directory.

After the deletion is complete, go back to the Stable Diffusion Extensions page and click the install button again.


If the installation doesn’t complete without any error messages or logs, please restart Stable Diffusion.

Sometimes, the failed extension will be automatically installed during the next startup. After restarting, check if the target extension has been installed.

PR

Result

The target Extension has been installed and is displayed in the Extensions – Installed tab, as shown below.

PR

APPENDIX: if it still doesn’t work


Create a folder with the extension’s name directly in the extensions folder and then clone the repository there (or download the source from Git and extract it).

If the Stable Diffusion server is running, shut it down temporarily and then restart it; the extensions should then be installed.

comment

Copied title and URL