Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(clients): default GitHub clones to HTTPS (#7760)

t3-code[bot]549201fcfd3b
diff --git a/apps/mobile/src/features/projects/AddProjectScreen.tsx b/apps/mobile/src/features/projects/AddProjectScreen.tsx
index c7e6b534a..b48c7a0bd 100644
--- a/apps/mobile/src/features/projects/AddProjectScreen.tsx
+++ b/apps/mobile/src/features/projects/AddProjectScreen.tsx
@@ -10,6 +10,8 @@ import {
getCloneDestinationBrowsePath,
getCloneDestinationPath,
getCloneDirectoryName,
+ getDefaultCloneUrl,
+ normalizePastedCloneUrl,
resolveAddProjectPath,
sortAddProjectProviderSources,
type AddProjectRemoteSource,
@@ -662,7 +664,7 @@ export function AddProjectRepositoryScreen(props: {
setIsSubmitting(true);
const provider = addProjectRemoteSourceProvider(source);
if (!provider) {
- const remoteUrl = repositoryInput.trim();
+ const remoteUrl = normalizePastedCloneUrl(repositoryInput);
navigation.dispatch(
StackActions.push("AddProjectDestination", {
environmentId: environment.environmentId,
@@ -691,7 +693,7 @@ export function AddProjectRepositoryScreen(props: {
StackActions.push("AddProjectDestination", {
environmentId: environment.environmentId,
source,
- remoteUrl: repository.sshUrl,
+ remoteUrl: getDefaultCloneUrl(repository),
repositoryTitle: repository.nameWithOwner,
repositoryName: getCloneDirectoryName(repository.nameWithOwner),
}),
diff --git a/apps/web/src/components/CommandPalette.tsx b/apps/web/src/components/CommandPalette.tsx
index b96eac7b0..afa5547ab 100644
--- a/apps/web/src/components/CommandPalette.tsx
+++ b/apps/web/src/components/CommandPalette.tsx
@@ -6,6 +6,8 @@ import {
getCloneDestinationBrowsePath,
getCloneDestinationPath,
getCloneDirectoryName,
+ getDefaultCloneUrl,
+ normalizePastedCloneUrl,
} from "@t3tools/client-runtime/operations/projects";
import { connectionStatusText } from "@t3tools/client-runtime/connection";
import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
@@ -1874,7 +1876,7 @@ function OpenCommandPaletteDialog(props: {
source: addProjectCloneFlow.source,
repositoryInput: rawRepository,
repository: null,
- remoteUrl: rawRepository,
+ remoteUrl: normalizePastedCloneUrl(rawRepository),
});
setHighlightedItemValue(null);
setQuery(destinationPath);
@@ -1914,7 +1916,7 @@ function OpenCommandPaletteDialog(props: {
source: addProjectCloneFlow.source,
repositoryInput: rawRepository,
repository,
- remoteUrl: repository.sshUrl,
+ remoteUrl: getDefaultCloneUrl(repository),
});
setHighlightedItemValue(null);
setQuery(destinationPath);
diff --git a/packages/client-runtime/src/operations/projects.test.ts b/packages/client-runtime/src/operations/projects.test.ts
index 60cc1bacd..cbbd12195 100644
--- a/packages/client-runtime/src/operations/projects.test.ts
+++ b/packages/client-runtime/src/operations/projects.test.ts
@@ -16,6 +16,8 @@ import {
getCloneDestinationBrowsePath,
getCloneDestinationPath,
getCloneDirectoryName,
+ getDefaultCloneUrl,
+ normalizePastedCloneUrl,
resolveAddProjectPath,
sortAddProjectProviderSources,
} from "./projects.ts";
@@ -46,6 +48,46 @@ describe("add project shared logic", () => {
expect(getCloneDirectoryName(null)).toBe("");
});
+ it("routes owner/repository shorthand to GitHub over HTTPS", () => {
+ expect(normalizePastedCloneUrl("imputnet/helium")).toBe(
+ "https://github.com/imputnet/helium.git",
+ );
+ expect(normalizePastedCloneUrl(" pingdotgg/t3code ")).toBe(
+ "https://github.com/pingdotgg/t3code.git",
+ );
+ });
+
+ it("keeps explicit clone URLs and local paths unchanged", () => {
+ expect(normalizePastedCloneUrl("https://gitlab.com/group/project.git")).toBe(
+ "https://gitlab.com/group/project.git",
+ );
+ expect(normalizePastedCloneUrl("[email protected]:owner/repo.git")).toBe(
+ "[email protected]:owner/repo.git",
+ );
+ expect(normalizePastedCloneUrl("group/subgroup/project")).toBe("group/subgroup/project");
+ expect(normalizePastedCloneUrl("/srv/git/repo.git")).toBe("/srv/git/repo.git");
+ });
+
+ it("uses HTTPS for repositories selected through a provider", () => {
+ expect(
+ getDefaultCloneUrl({
+ provider: "github",
+ url: "https://github.com/imputnet/helium",
+ sshUrl: "[email protected]:imputnet/helium.git",
+ }),
+ ).toBe("https://github.com/imputnet/helium");
+ });
+
+ it("preserves existing clone transport behavior for other providers", () => {
+ expect(
+ getDefaultCloneUrl({
+ provider: "gitlab",
+ url: "https://gitlab.com/group/project.git",
+ sshUrl: "[email protected]:group/project.git",
+ }),
+ ).toBe("[email protected]:group/project.git");
+ });
+
it("derives the clone folder name from any pasted clone URL", () => {
expect(getCloneDirectoryName("https://github.com/owner/repo.git")).toBe("repo");
expect(getCloneDirectoryName("https://github.com/owner/repo")).toBe("repo");
diff --git a/packages/client-runtime/src/operations/projects.ts b/packages/client-runtime/src/operations/projects.ts
index 914931689..3f5fc3667 100644
--- a/packages/client-runtime/src/operations/projects.ts
+++ b/packages/client-runtime/src/operations/projects.ts
@@ -106,6 +106,24 @@ export function addProjectRemoteSourceProvider(
return source === "url" ? null : source;
}
+const GITHUB_REPOSITORY_SHORTHAND =
+ /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})\/[A-Za-z0-9._-]+(?:\.git)?$/;
+
+/** Treat the common owner/repository shorthand as a public GitHub HTTPS URL. */
+export function normalizePastedCloneUrl(input: string): string {
+ const trimmed = input.trim();
+ if (!GITHUB_REPOSITORY_SHORTHAND.test(trimmed)) return trimmed;
+ const repository = trimmed.endsWith(".git") ? trimmed : `${trimmed}.git`;
+ return `https://github.com/${repository}`;
+}
+
+/** GitHub defaults to HTTPS; other providers retain their existing SSH default. */
+export function getDefaultCloneUrl(
+ repository: Pick<SourceControlRepositoryInfo, "provider" | "url" | "sshUrl">,
+): string {
+ return repository.provider === "github" ? repository.url : repository.sshUrl;
+}
+
export function sortAddProjectProviderSources(
readinessBySource: AddProjectRemoteSourceReadiness,
): ReadonlyArray<AddProjectRemoteProviderKind> {