Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Catch exception of repository clone

Yue Liuca47a58a5db6
diff --git a/autogpt/commands/git_operations.py b/autogpt/commands/git_operations.py
index 3483474ba3..3ff35cf31a 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)}"