diff --git a/apps/desktop/src/components/GitForm.svelte b/apps/desktop/src/components/GitForm.svelte index 9cc6c0c87a..24074d5b05 100644 --- a/apps/desktop/src/components/GitForm.svelte +++ b/apps/desktop/src/components/GitForm.svelte @@ -3,7 +3,6 @@ import KeysForm from '$components/KeysForm.svelte'; import ReduxResult from '$components/ReduxResult.svelte'; import SettingsSection from '$components/SettingsSection.svelte'; - import { BACKEND } from '$lib/backend'; import { PROJECTS_SERVICE } from '$lib/project/projectsService'; import { inject } from '@gitbutler/core/context'; import { CardGroup, Spacer, Toggle } from '@gitbutler/ui'; @@ -12,7 +11,6 @@ const { projectId }: { projectId: string } = $props(); const projectsService = inject(PROJECTS_SERVICE); const projectQuery = $derived(projectsService.getProject(projectId)); - const backend = inject(BACKEND); async function onForcePushClick(project: Project, value: boolean) { await projectsService.updateProject({ ...project, ok_with_force_push: value }); @@ -25,10 +23,8 @@ - {#if backend.platformName !== 'windows'} - - - {/if} + + diff --git a/apps/desktop/src/components/KeysForm.svelte b/apps/desktop/src/components/KeysForm.svelte index 99b251d96e..fdab61dc4d 100644 --- a/apps/desktop/src/components/KeysForm.svelte +++ b/apps/desktop/src/components/KeysForm.svelte @@ -3,6 +3,7 @@ import ProjectNameLabel from '$components/ProjectNameLabel.svelte'; import ReduxResult from '$components/ReduxResult.svelte'; import SettingsSection from '$components/SettingsSection.svelte'; + import { BACKEND } from '$lib/backend'; import { BASE_BRANCH_SERVICE } from '$lib/baseBranch/baseBranchService.svelte'; import { showError } from '$lib/notifications/toasts'; import { type AuthKey, type KeyType } from '$lib/project/project'; @@ -36,11 +37,18 @@ const projectsService = inject(PROJECTS_SERVICE); const projectQuery = $derived(projectsService.getProject(projectId)); const project = $derived(projectQuery.response); + const backend = inject(BACKEND); + const isWindows = $derived(backend.platformName === 'windows'); let credentialCheck = $state(); + function getDefaultCredentialType(): KeyType { + // Use systemExecutable on Windows since other options are not available + return isWindows ? 'systemExecutable' : 'local'; + } + let selectedType: KeyType = $derived( - typeof project?.preferred_key === 'string' ? project?.preferred_key : 'local' + typeof project?.preferred_key === 'string' ? project?.preferred_key : getDefaultCredentialType() ); let privateKeyPath = $state(''); @@ -104,6 +112,11 @@ {#snippet description()} Configure the authentication flow for GitButler when authenticating with your Git remote provider. + {#if isWindows} +

+ On Windows, only the Git executable option is available for compatibility + reasons. + {/if} {/snippet}
- - {#snippet title()} - Use existing SSH key - {/snippet} - - {#snippet actions()} - - {/snippet} - - {#snippet caption()} - {#if selectedType === 'local'} - Add the path to an existing SSH key that GitButler can use. - {/if} - {/snippet} - + {#if !isWindows} + + {#snippet title()} + Use existing SSH key + {/snippet} + + {#snippet actions()} + + {/snippet} + + {#snippet caption()} + {#if selectedType === 'local'} + Add the path to an existing SSH key that GitButler can use. + {/if} + {/snippet} + - {#if selectedType === 'local'} - -
- { - debouncedUpdateLocalKey(value); - }} + {#if selectedType === 'local'} + +
+ { + debouncedUpdateLocalKey(value); + }} + /> +
+
+ {/if} + + + {#snippet title()} + Use a Git credentials helper + {/snippet} + + {#snippet caption()} + {#if selectedType === 'gitCredentialsHelper'} + GitButler will use the system's git credentials helper. + Learn more + {/if} + {/snippet} + + {#snippet actions()} + -
+ {/snippet}
{/if} - - {#snippet title()} - Use a Git credentials helper - {/snippet} - - {#snippet caption()} - {#if selectedType === 'gitCredentialsHelper'} - GitButler will use the system's git credentials helper. - Learn more - {/if} - {/snippet} - - {#snippet actions()} - - {/snippet} - -