feat: add native git credential provider and update related components#10027
Open
gatzjames wants to merge 2 commits into
Open
feat: add native git credential provider and update related components#10027gatzjames wants to merge 2 commits into
gatzjames wants to merge 2 commits into
Conversation
c484d0b to
cbffcb1
Compare
Contributor
There was a problem hiding this comment.
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
nativeGit remote provider (registry + provider types) that usesgit credential fillfor authentication. - Threads
repoPathinto git callbacks and author lookup so native credentials can resolve identity viagit config. - Updates UI components to use optional chaining for
authorfields 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.
cbffcb1 to
848cf78
Compare
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.
7722bc8 to
0febcec
Compare
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) || '', | ||
| }, | ||
| }; |
yaoweiprc
approved these changes
Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes INS-1857