Fix for adding ComfyUI path to Git safe.directory

Git wants a path that looks like this: D:/ComfyUI
This commit is contained in:
mortael 2023-12-31 19:41:59 +01:00 committed by GitHub
parent 6ffb10becb
commit 7e4b5c4f3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -317,8 +317,9 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
if 'detected dubious' in output:
try:
# fix and try again
print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on '{path}' repo")
process = subprocess.Popen(['git', 'config', '--global', '--add', 'safe.directory', path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
safedir_path = path.replace('\\', '/')
print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on '{safedir_path}' repo")
process = subprocess.Popen(['git', 'config', '--global', '--add', 'safe.directory', safedir_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, _ = process.communicate()
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@ -330,7 +331,7 @@ def __win_check_git_update(path, do_fetch=False, do_update=False):
if 'detected dubious' in output:
print(f'\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n'
f'-----------------------------------------------------------------------------------------\n'
f'git config --global --add safe.directory "{path}"\n'
f'git config --global --add safe.directory "{safedir_path}"\n'
f'-----------------------------------------------------------------------------------------\n')
if do_update:
@ -1516,16 +1517,17 @@ async def update_comfyui(request):
try:
remote.fetch()
except Exception as e:
except Exception as str(e):
if 'detected dubious' in e:
print(f"[ComfyUI-Manager] Try fixing 'dubious repository' error on 'ComfyUI' repository")
subprocess.run(['git', 'config', '--global', '--add', 'safe.directory', comfy_path])
safedir_path = comfy_path.replace('\\', '/')
subprocess.run(['git', 'config', '--global', '--add', 'safe.directory', safedir_path])
try:
remote.fetch()
except Exception:
print(f"\n[ComfyUI-Manager] Failed to fixing repository setup. Please execute this command on cmd: \n"
f"-----------------------------------------------------------------------------------------\n"
f'git config --global --add safe.directory "{comfy_path}"\n'
f'git config --global --add safe.directory "{safedir_path}"\n'
f"-----------------------------------------------------------------------------------------\n")
commit_hash = repo.head.commit.hexsha