From ca47a58a5db6bb467b70d219df70c836fe0f21de Mon Sep 17 00:00:00 2001 From: Yue Liu <41297969+YueLiu-coder@users.noreply.github.com> Date: Sun, 16 Apr 2023 13:47:13 +0800 Subject: [PATCH] Catch exception of repository clone --- autogpt/commands/git_operations.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/autogpt/commands/git_operations.py b/autogpt/commands/git_operations.py index 3483474b..3ff35cf3 100644 --- a/autogpt/commands/git_operations.py +++ b/autogpt/commands/git_operations.py @@ -16,5 +16,8 @@ def clone_repository(repo_url: str, clone_path: str) -> str: str: The result of the clone operation""" split_url = repo_url.split("//") auth_repo_url = f"//{CFG.github_username}:{CFG.github_api_key}@".join(split_url) - git.Repo.clone_from(auth_repo_url, clone_path) - return f"""Cloned {repo_url} to {clone_path}""" + try: + git.Repo.clone_from(auth_repo_url, clone_path) + return f"""Cloned {repo_url} to {clone_path}""" + except Exception as e: + return f"Error: {str(e)}"