[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:36:26 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:

That does look like it would work-around it, although I'm hesitant to use any kind of git credential manager. The ssh key I use requires a password which I like because it slows things down and can help avoid accidental pushes. Plus I'm not sure how well it would work with my work github instance so I'd have to test that out.

If there isn't much interest in this change, I'm fine with just carrying the change locally.

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


More information about the llvm-commits mailing list