[llvm] Have merge script detect whether to use https or ssh to connect to github. (PR #218380)

Douglas Yung via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 05:09:16 PDT 2026


================
@@ -141,11 +141,19 @@ def load_pr_data(self):
         )
         self.prdata = json.loads(o)
 
+        # Determine if we use https or ssh to connect to github
+        remote = subprocess.run(
+            ["git", "remote", "get-url", self.args.upstream],
+            capture_output=True,
+            text=True,
+        )
+        upstream_remote_type = remote.stdout.strip().replace("llvm/llvm-project.git", "")
+
         # save the baseRefName (target branch) so that we know where to push
         self.target_branch = self.prdata["baseRefName"]
         srepo = self.prdata["headRepository"]["name"]
         sowner = self.prdata["headRepositoryOwner"]["login"]
-        self.source_url = f"https://github.com/{sowner}/{srepo}"
+        self.source_url = f"{upstream_remote_type}{sowner}/{srepo}"
----------------
dyung wrote:

Here is my output when trying to merge a change:
```
...
> Rebasing...
Successfully rebased and updated refs/heads/llvm_merger_217720.
> Publish rebase...
Username for 'https://github.com': dyung
Password for 'https://dyung@github.com': 
remote: Invalid username or token. Password authentication is not supported for Git operations.
fatal: Authentication failed for 'https://github.com/llvm/llvm-project/'
```
I just entered random text for the password since I don't use a PAT

https://github.com/llvm/llvm-project/pull/218380


More information about the llvm-commits mailing list