From 5c8c647be1651f0508d9c0faa0e974e66e9e4ba4 Mon Sep 17 00:00:00 2001 From: Sam Chau Date: Wed, 18 Sep 2024 19:23:08 +0930 Subject: [PATCH] fix: stop appending token for 2+ requests --- backend/app/git/branches/push.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/git/branches/push.py b/backend/app/git/branches/push.py index 1d8bc5d..83e568e 100644 --- a/backend/app/git/branches/push.py +++ b/backend/app/git/branches/push.py @@ -45,7 +45,8 @@ def push_branch_to_remote(repo_path, branch_name): # Get the remote URL and inject the GitHub token origin = repo.remote(name='origin') url = list(urlparse(next(origin.urls))) - url[1] = f"{github_token}@{url[1]}" # Inject GitHub token into the URL + if '@' not in url[1]: # Only add the token if it's not already there + url[1] = f"{github_token}@{url[1]}" # Inject GitHub token into the URL auth_url = urlunparse(url) # Set the new URL with the GitHub token