Skip to content

Manage Desktop commit authorship by account - #23229

Merged
niik merged 8 commits into
developmentfrom
niik-multi-account-release-2
Nov 28, 2026
Merged

niik merged 8 commits into
developmentfrom
niik-multi-account-release-2

Conversation

@niik

@niik niik commented Nov 25, 2026 •

Copy link
Copy Markdown
Member

Closes github/gh-cli-and-desktop#382

Relates to github/gh-cli-and-desktop#375. External Git configuration management (github/gh-cli-and-desktop#386) remains separate work.

Description

Repositories assigned to different accounts need separate commit identities without changing the identity used by other Git applications. This adds an opt-in Use a separate identity for each account mode; Use Git configuration remains the default.

  • Retain credential-free account identities after sign-out. Profile-derived names and privacy-aware emails follow profile updates until each field is explicitly overridden.
  • Select identities by repository assignment, prioritizing exact registered checkout paths over worktree aliases. Unassigned repositories keep Git's existing identity behavior.
  • Pass author/committer environment variables to Desktop's Git child processes and repository-scoped Copilot clients. Assisted runs freeze their identity, including during ref publication and rollback; native Git preserves original authors during amend, cherry-pick, and rebase.
  • Provide compact Edit/Done identity editors with Preferences Save/Cancel semantics. Attribution popovers explain account-scoped edits, retain misattribution and repository-rule checks, and disclose that signed-out attribution cannot be verified.

Managed mode does not write identity settings to Git configuration. Accounts already signed out before upgrading may need to sign in once to initialize a retained identity. Non-identity read-only Git commands remain available while an identity is missing or invalid; identity queries and mutations report the error instead of silently falling back to Git configuration. A custom email does not guarantee GitHub attribution.

Validation

Validated source is committed as 6c99bb01a9001a8306a6b76a25b8d3494766b449; the working tree is clean.

  • GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.bareRepository GIT_CONFIG_VALUE_0=all npm test - passed: 3,511 tests passed, 2 skipped, no failures. The command-local setting accommodates this machine's bare-repository policy; no persistent Git configuration was changed.
  • node_modules/.bin/tsc --noEmit - passed.
  • npm run lint:fix and npm run lint - passed.
  • Native Git regressions cover readable status/history with an unavailable identity, blocked authorship, complete versus partial identity overrides, explicit unset values, frozen assisted execution, and rollback after publication.
  • Real Electron checks verified staged Save/Cancel behavior and same-row Cancel/Edit actions. Screenshots below use sample account data and predate the final non-visual worktree and identity-resolution fixes; the pictured UI is unchanged.

Team-authored review

Evidence: Validation and screenshots.

Review path: Lightweight review. Managed authorship adds local, credential-free preferences and child-process identity variables without changing authentication or credential handling.

Screenshots

Git configuration mode with a compact identity editor

Git configuration mode with a global name/email summary and Edit button

Per-account identity editing, including retained signed-out identities

Per-account identity mode with one account's name and email expanded for editing

Account-aware attribution popover

Managed account attribution popover explaining cross-repository edits with Cancel and Edit Account Identity on one row

Release notes

Notes: [New] Configure a separate commit name and email for each repository's assigned account without changing other Git applications

niik and others added 4 commits November 17, 2026 10:20
Retain credential-free authorship preferences, apply repository-scoped Git and Copilot environments, and provide compact inline identity editing.

Co-authored-by: Copilot App <[email protected]>
Explain Git configuration and per-account identities with persistent accessible descriptions while retaining compact inline editing.

Co-authored-by: Copilot App <[email protected]>
Explain account-scoped identity edits and signed-out attribution limits, keep popover actions inline, and prioritize exact registered checkout assignments over worktree aliases.

Co-authored-by: Copilot App <[email protected]>
@niik
niik requested a review from a team as a code owner November 25, 2026 13:01
@niik
niik requested review from sergiou87 and a balanced review from Copilot November 25, 2026 13:01

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.

🟡 Changes recommended

Unconditional identity resolution can block repository reads and falsely mark valid checkouts missing, while unnecessary live lookup can abort assisted runs that already supply frozen identity values.

2 open issues
What changed in this PR

Adds opt-in, account-scoped commit identities to GitHub Desktop while keeping Git configuration as the default and leaving other Git applications unaffected.

Changes:

  • Retains credential-free identities after sign-out, with profile defaults and per-field overrides.
  • Applies repository-assigned identities to Git and Copilot child processes, capturing identity variables for assisted runs.
  • Adds staged identity editors, account-aware attribution guidance, documentation, and regression tests.
File Description
docs/​technical/​oauth.md Documents managed identities and attribution behavior.
app/​test/​unit/​ui/​managed-commit-identity-test.tsx Tests identity editors, mode selection, and validation.
app/​test/​unit/​ui/​commit-message-test.tsx Tests managed and unassigned attribution controls.
app/​test/​unit/​ui/​commit-message-avatar-test.tsx Tests account-aware popovers and email selection.
app/​test/​unit/​stores/​copilot-store-credentials-test.ts Tests authorship in isolated planning environments.
app/​test/​unit/​stores/​app-store-accounts-test.ts Tests assignment-based identity and worktree precedence.
app/​test/​unit/​managed-commit-identity-test.ts Tests persistence, profile refreshes, and overrides.
app/​test/​unit/​git/​managed-commit-identity-test.ts Tests Git authorship and assisted-run identity snapshots.
app/​test/​unit/​accounts-store-test.ts Supplies a valid account endpoint in a fixture.
app/​styles/​ui/​_radio-button.scss Styles radio-button descriptions.
app/​styles/​ui/​_preferences.scss Styles compact identity summaries and editors.
app/​styles/​ui/​_dialog.scss Enables scrolling in Git preferences.
app/​styles/​ui/​_commit-message-avatar.scss Aligns managed-identity action buttons.
app/​src/​ui/​repository.tsx Passes identity mode to the changes sidebar.
app/​src/​ui/​repository-settings/​repository-settings.tsx Integrates managed identities into repository settings.
app/​src/​ui/​repository-settings/​git-config.tsx Displays managed identity instead of Git configuration controls.
app/​src/​ui/​preferences/​preferences.tsx Stages and saves identity preferences.
app/​src/​ui/​preferences/​git.tsx Adds mode selection and inline identity editors.
app/​src/​ui/​lib/​radio-group.tsx Supports descriptions for individual choices.
app/​src/​ui/​lib/​radio-button.tsx Exposes supporting text as accessible descriptions.
app/​src/​ui/​index.tsx Registers repository-scoped identity lookup.
app/​src/​ui/​dispatcher/​dispatcher.ts Routes identity and email updates to AppStore.
app/​src/​ui/​commit-message/​commit-message-dialog.tsx Connects dialogs to managed authorship controls.
app/​src/​ui/​changes/​sidebar.tsx Forwards identity mode to the changes list.
app/​src/​ui/​changes/​filter-changes-list.tsx Wires identity mode and email updates into commits.
app/​src/​ui/​changes/​commit-message.tsx Connects attribution UI to account identities.
app/​src/​ui/​changes/​commit-message-avatar.tsx Adds managed-identity and signed-out guidance.
app/​src/​ui/​app.tsx Supplies identity settings to application views.
app/​src/​lib/​stores/​git-store-cache.ts Exposes the latest cached repository association.
app/​src/​lib/​stores/​copilot-store.ts Adds repository authorship to Copilot environments.
app/​src/​lib/​stores/​app-store.ts Resolves identities and coordinates authorship updates.
app/​src/​lib/​stores/​accounts-store.ts Persists and refreshes credential-free identities.
app/​src/​lib/​managed-commit-identity.ts Defines identity models, validation, and environment mapping.
app/​src/​lib/​git/​spawn.ts Adds managed identity variables to spawned Git processes.
app/​src/​lib/​git/​core.ts Merges managed identity into Git execution environments.
app/​src/​lib/​git/​assisted-commit/​git.ts Captures identity variables for private assisted execution.
app/​src/​lib/​app-state.ts Adds identity settings to shared application state.

Review effort: Balanced

Comment thread app/src/lib/stores/app-store.ts Resolved
Comment thread app/src/lib/git/core.ts Resolved
sergiou87
sergiou87 previously approved these changes Nov 25, 2026
Resolve managed identities only for mutations and identity queries. Honor complete caller-supplied identity environments, including explicit unset keys, and preserve frozen identities during assisted ref publication and rollback.

Co-authored-by: Copilot App <[email protected]>
niik and others added 3 commits November 26, 2026 12:30
Preserve managed commit identity propagation alongside the updated Copilot request implementation.

Co-authored-by: Copilot App <[email protected]>
@niik
niik merged commit 03643b8 into development Nov 28, 2026
9 checks passed
@niik
niik deleted the niik-multi-account-release-2 branch November 28, 2026 23:18
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.

4 participants