From f45a36429e165660f704d96946f03434fe6cf4de Mon Sep 17 00:00:00 2001 From: Mnigos Date: Thu, 24 Sep 2026 05:23:36 +0200 Subject: [PATCH 1/2] fix(clients): default GitLab clones to HTTPS Provider-selected GitLab clones used the SSH URL, so a host with glab signed in over HTTPS and no SSH key for GitLab failed with a host key error and had no way to pick the protocol. GitLab now joins GitHub and Forgejo on the HTTPS URL, which the glab credential helper authenticates. --- .../src/operations/projects.test.ts | 15 +++++++++++---- .../client-runtime/src/operations/projects.ts | 9 +++++++-- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/client-runtime/src/operations/projects.test.ts b/packages/client-runtime/src/operations/projects.test.ts index 4b29e67a2176..a264d1a8d49d 100644 --- a/packages/client-runtime/src/operations/projects.test.ts +++ b/packages/client-runtime/src/operations/projects.test.ts @@ -83,16 +83,23 @@ describe("add project shared logic", () => { sshUrl: "ssh://git@forgejo.example.test:2222/owner/repo.git", }), ).toBe("https://forgejo.example.test:8443/owner/repo.git"); - }); - - it("preserves existing clone transport behavior for other providers", () => { expect( getDefaultCloneUrl({ provider: "gitlab", url: "https://gitlab.com/group/project.git", sshUrl: "git@gitlab.com:group/project.git", }), - ).toBe("git@gitlab.com:group/project.git"); + ).toBe("https://gitlab.com/group/project.git"); + }); + + it("preserves existing clone transport behavior for other providers", () => { + expect( + getDefaultCloneUrl({ + provider: "bitbucket", + url: "https://bitbucket.org/workspace/repo.git", + sshUrl: "git@bitbucket.org:workspace/repo.git", + }), + ).toBe("git@bitbucket.org:workspace/repo.git"); }); it("derives the clone folder name from any pasted clone URL", () => { diff --git a/packages/client-runtime/src/operations/projects.ts b/packages/client-runtime/src/operations/projects.ts index 597b0b5d7b4f..85b5151a7e18 100644 --- a/packages/client-runtime/src/operations/projects.ts +++ b/packages/client-runtime/src/operations/projects.ts @@ -122,11 +122,16 @@ export function normalizePastedCloneUrl(input: string): string { return `https://github.com/${repository}`; } -/** GitHub and Forgejo default to HTTPS; other providers retain their existing SSH default. */ +/** + * GitHub, GitLab, and Forgejo default to HTTPS: their CLIs install a Git credential helper on + * sign-in, while SSH needs a separately registered key. Other providers keep their SSH default. + */ export function getDefaultCloneUrl( repository: Pick, ): string { - return repository.provider === "github" || repository.provider === "forgejo" + return repository.provider === "github" || + repository.provider === "gitlab" || + repository.provider === "forgejo" ? repository.url : repository.sshUrl; } From 8776812d84b4061129a5158600361fcf88c87001 Mon Sep 17 00:00:00 2001 From: Mnigos Date: Thu, 24 Sep 2026 05:31:27 +0200 Subject: [PATCH 2/2] test(client-runtime): use GitLab's web_url in the clone fixture --- packages/client-runtime/src/operations/projects.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/client-runtime/src/operations/projects.test.ts b/packages/client-runtime/src/operations/projects.test.ts index a264d1a8d49d..8c74e6a8bbe5 100644 --- a/packages/client-runtime/src/operations/projects.test.ts +++ b/packages/client-runtime/src/operations/projects.test.ts @@ -86,10 +86,11 @@ describe("add project shared logic", () => { expect( getDefaultCloneUrl({ provider: "gitlab", - url: "https://gitlab.com/group/project.git", + // The lookup returns GitLab's web_url here, which git clones as well. + url: "https://gitlab.com/group/project", sshUrl: "git@gitlab.com:group/project.git", }), - ).toBe("https://gitlab.com/group/project.git"); + ).toBe("https://gitlab.com/group/project"); }); it("preserves existing clone transport behavior for other providers", () => {