Skip to content

feat: add native git credential provider and update related components#10027

Open
gatzjames wants to merge 2 commits into
Kong:developfrom
gatzjames:feat/local-git-credentials
Open

feat: add native git credential provider and update related components#10027
gatzjames wants to merge 2 commits into
Kong:developfrom
gatzjames:feat/local-git-credentials

Conversation

@gatzjames

@gatzjames gatzjames commented Jun 4, 2026

Copy link
Copy Markdown
Contributor
  • Introduced a new NativeGitCredential type to support system git credential manager.
  • Updated GitCredentials model to include native provider type.
  • Implemented NativeProvider class to handle authentication via OS git credential manager.
  • Refactored git service and utils to accommodate new repoPath parameter for native credentials.
  • Enhanced UI components to support native credential setup and display.
  • Updated migrations to ensure native credential singleton exists on startup.
  • Adjusted various components to handle optional chaining for author fields.

Closes INS-1857

@gatzjames gatzjames requested a review from a team June 4, 2026 11:52
@gatzjames gatzjames self-assigned this Jun 4, 2026
Copilot AI review requested due to automatic review settings June 4, 2026 11:52
@gatzjames gatzjames force-pushed the feat/local-git-credentials branch from c484d0b to cbffcb1 Compare June 4, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for a native/system Git credential provider (delegating auth to the OS Git credential manager) and threads a repoPath through Git auth/author resolution so native Git config and credential helpers can be consulted at runtime. It also updates several UI surfaces to tolerate missing/optional author fields and to treat native credentials differently from OAuth/PAT credentials.

Changes:

  • Introduces a native Git remote provider (registry + provider types) that uses git credential fill for authentication.
  • Threads repoPath into git callbacks and author lookup so native credentials can resolve identity via git config.
  • Updates UI components to use optional chaining for author fields and adjusts credentials listing behavior for native credentials.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/insomnia/src/ui/components/settings/credentials.tsx Updates credential UI to handle optional author and special-case native credentials (but contains a runtime bug in an optional-chaining chain).
packages/insomnia/src/ui/components/project/project-settings-form.tsx Uses optional chaining for selected credential author fields.
packages/insomnia/src/ui/components/project/git-repo-form.tsx Uses optional chaining for selected credential author fields and email selection keys.
packages/insomnia/src/ui/components/modals/git-repository-settings-modal/git-repository-settings-modal.tsx Uses optional chaining for author name/email display.
packages/insomnia/src/ui/components/git/git-oauth-auth-banner.tsx Extends provider type union to include native.
packages/insomnia/src/ui/components/git-credentials/git-native-credential-form.tsx Adds a form component for native credential creation/update.
packages/insomnia/src/ui/components/git-credentials/credential-setup.tsx Minor formatting-only change.
packages/insomnia/src/sync/git/utils.ts Adds repoPath to auth callbacks and resolves native author via git config.
packages/insomnia/src/sync/git/providers/types.ts Extends provider types/config union and updates authCallback signature.
packages/insomnia/src/sync/git/providers/native.ts Adds native provider implementation using git credential fill.
packages/insomnia/src/sync/git/providers/index.ts Registers the native provider in the provider registry.
packages/insomnia/src/sync/git/providers/gitlab.ts Updates provider authCallback signature.
packages/insomnia/src/sync/git/providers/github.ts Updates provider authCallback signature.
packages/insomnia/src/sync/git/providers/custom.ts Updates provider authCallback signature.
packages/insomnia/src/sync/git/git-vcs.ts Threads repoPath into init flows and author resolution.
packages/insomnia/src/main/git/migrations.ts Attempts to ensure native credential singleton exists on startup (but currently won’t run in the “migration already ran” path).
packages/insomnia/src/main/git-service.ts Centralizes git base-dir computation and passes repoPath into GitVCS.
packages/insomnia/src/insomnia-data/src/models/types.ts Re-exports the new NativeGitCredential type.
packages/insomnia/src/insomnia-data/src/models/git-credentials.ts Adds native credential type and updates v2 type guard behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/insomnia/src/ui/components/settings/credentials.tsx
Comment thread packages/insomnia/src/main/git/migrations.ts Outdated
Comment thread packages/insomnia/src/sync/git/providers/native.ts
@gatzjames gatzjames force-pushed the feat/local-git-credentials branch from cbffcb1 to 848cf78 Compare June 8, 2026 15:51
yaoweiprc
yaoweiprc previously approved these changes Jun 9, 2026
- Introduced a new NativeGitCredential type to support system git credential manager.
- Updated GitCredentials model to include native provider type.
- Implemented NativeProvider class to handle authentication via OS git credential manager.
- Refactored git service and utils to accommodate new repoPath parameter for native credentials.
- Enhanced UI components to support native credential setup and display.
- Updated migrations to ensure native credential singleton exists on startup.
- Adjusted various components to handle optional chaining for author fields.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.

Comment on lines +616 to 618
{credentialsFetcher.data?.credentials.filter(c => c.provider !== 'native').length === 0 && (
<p className="text-center">No Git credentials configured</p>
)}
Comment on lines +640 to +660
<>
{isGitCredentialsV2(item) && 'author' in item && (item as any).author?.avatarUrl ? (
<img
src={(item as any).author.avatarUrl}
alt={(item as any).author.name || 'Avatar'}
className="h-6 w-6 rounded-full"
/>
) : (
<div className="flex h-6 w-6 items-center justify-center rounded-full bg-(--hl-sm) text-xs font-bold text-(--color-font-muted)">
{isGitCredentialsV2(item) && 'author' in item && (item as any).author?.name
? (item as any).author.name.charAt(0).toUpperCase()
: '?'}
</div>
)}
{isGitCredentialsV2(item) && 'author' in item && (
<>
<span>{(item as any).author?.name}</span>
<span>{(item as any).author?.email}</span>
</>
)}
</>
Comment on lines +269 to 273
const existing = await database.findOne<GitCredentials>(models.gitCredentials.type, { provider: 'native' });
if (!existing) {
await services.gitCredentials.create({ provider: 'native' });
console.log('[git-credentials-migration] Created native credential singleton');
}
Comment on lines +20 to +42
const createCredentialFetcher = useGitCredentialsCreateActionFetcher();
const updateCredentialFetcher = useGitCredentialsUpdateActionFetcher();
const isEditing = !!gitCredentialToEdit;

const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
const form = event.target as HTMLFormElement;
const formData = new FormData(form);

const credentialData = {
provider: 'native' as const,
name: (formData.get('label') as string) || 'System Git Credentials',
author: {
name: (formData.get('authorName') as string) || '',
email: (formData.get('authorEmail') as string) || '',
},
};

await (isEditing && gitCredentialToEdit._id
? updateCredentialFetcher.submit(gitCredentialToEdit._id, credentialData)
: createCredentialFetcher.submit(credentialData));
onComplete?.();
};
Comment on lines +29 to +36
const credentialData = {
provider: 'native' as const,
name: (formData.get('label') as string) || 'System Git Credentials',
author: {
name: (formData.get('authorName') as string) || '',
email: (formData.get('authorEmail') as string) || '',
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants