Skip to content

Manage repositories for an account - #23223

Merged
niik merged 9 commits into
developmentfrom
niik-manage-repositories-for-account
Dec 1, 2026
Merged

niik merged 9 commits into
developmentfrom
niik-manage-repositories-for-account

Conversation

@niik

@niik niik commented Nov 24, 2026

Copy link
Copy Markdown
Member

Closes #376

Description

With multiple accounts on the same host, there was no way to review or change which local repositories use an account, other than one at a time from Repository settings. This PR adds a Manage repositories dialog that does it for all repositories on the account's host at once.

Dialog (ManageAccountRepositoriesDialog, logic in app/src/lib/account-repositories.ts)

  • Lists every tracked repository on the account's host, with its current association: unassigned, another account (including signed-out logins), or this account. The list isn't filtered by verified access.
  • Repositories that are unassigned or already assigned to this account start checked.
  • On confirm:
    • Checked repositories are assigned to the account.
    • Unchecking a repository that was assigned to this account leaves it unassigned.
    • Other unchecked repositories keep their association.
  • Filter box, Select all/none, a selected count, and click-anywhere-to-toggle rows.
  • If the host has no repositories, an empty state explains this and "Assign selected" isn't shown.
  • Only the stored association changes (RepositoriesStore.updateRepositoryAccounts). Git remotes, author name and email are not modified.

When it opens

  • Automatically after a previously unknown account is added from Account settings, and only if Desktop tracks repositories on that host.
  • It does not open when an existing account signs in again to refresh credentials (isPreviouslyUnknownAccount).
  • From the new "Manage repositories..." action on any account in Account settings.

Account settings redesign

  • New header with a short description and an "Add account" dropdown (GitHub.com / GitHub Enterprise).
  • Accounts appear in a single list, with GitHub.com first and then the others alphabetically by host. Each row shows @login · host.
  • Per-account actions (Manage repositories, Sign out) moved into a borderless overflow (kebab) button. It meets WCAG AA contrast in both themes, at rest and on hover.

No metrics are added.

Screenshots

Screenshots use fake accounts and repositories.

Manage repositories (light) Manage repositories (dark)
Manage repositories dialog, light theme Manage repositories dialog, dark theme
Empty state Account settings
Empty state Account settings

Validation

At 23d5e0d85f, these passed:

  • tsc --noEmit
  • eslint and prettier on the changed files
  • targeted unit and UI tests:
    • account-repositories-test.ts
    • ui/manage-account-repositories-test.tsx
    • ui/preferences-accounts-test.tsx

Earlier commits on the branch also passed:

  • repositories-store-test.ts
  • stores/app-store-accounts-test.ts
  • ui/invalidated-token-test.tsx

Manually checked in a built app with fake accounts, in light and dark themes:

  • the dialog, including the filtered, no-matches and empty states
  • Account settings

The full unit suite was not run locally; CI covers it.

Team-authored review

Evidence: See the Screenshots and Validation sections above.

Review path: needs-deep-review.
A repository's account association decides which account's credentials Desktop uses for GitHub API requests and HTTPS Git authentication, so this changes a credential trust boundary. Areas for in-depth review:

  • getAccountRepositoryChanges / getInitialAccountRepositorySelection in app/src/lib/account-repositories.ts: confirm that unchecked repositories assigned to other accounts are never reassigned or cleared.
  • isPreviouslyUnknownAccount and the post-sign-in flow in AppStore: confirm that a credential refresh for an existing account never opens the dialog.
  • RepositoriesStore.updateRepositoryAccounts and AppStore._updateAccountRepositories: confirm that only the association is persisted, open repository stores pick it up, and Git remotes are untouched.

Release notes

Notes: [Added] Choose which repositories use an account from the Accounts settings - #376

niik and others added 9 commits November 23, 2026 13:28
Let users assign tracked repositories on an account's host to that
account from a new "Manage repositories" action in Account settings.
The dialog also opens automatically after a previously unknown account
signs in from Account settings when its host has tracked repositories;
credential refreshes of an existing account do not open it.

Unassigned repositories and repositories already on the account start
selected. Confirming assigns selected repositories, clears the
assignment of deselected repositories that were on the account, and
leaves every other repository's association unchanged. Assignments are
saved in a single transaction and Git remotes are never rewritten.

Refs #376

Co-authored-by: Copilot App <[email protected]>
Replace the per-account Manage repositories and Sign out buttons with a
single overflow button that opens a contextual menu.

Co-authored-by: Copilot App <[email protected]>
… menu

Replace the grouped GitHub.com/Enterprise sections with a single sorted
account list (GitHub.com first, then by host) that shows each account's
endpoint, and add a header with an Add account dropdown.

Co-authored-by: Copilot App <[email protected]>
- Fix rows inheriting the dialog's list-item margin, which left a large
  empty band under every row and made the details hug the top.
- Lay each row out on a grid: checkbox, name over owner/name, and the
  current association vertically centered on the right, with a person
  icon for assigned accounts and emphasis for this account.
- Make the whole row toggle its checkbox and add a hover state that keeps
  secondary text above AA contrast in both themes.
- Give the filter the full width with a search icon and a single clear
  button, and move Select all/none into a list header with a selection
  count.
- Keep the list area a fixed height so filtering and no-matches don't
  resize the dialog, and move the unselecting caveat below the list.

Co-authored-by: Copilot App <[email protected]>
@niik
niik requested a review from a team as a code owner November 24, 2026 13:37
@niik
niik requested review from BagToad and a balanced review from Copilot November 24, 2026 13:37
@niik niik added the needs-deep-review Requires in-depth human code review of affected paths; agent review is not sufficient. label Nov 24, 2026

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

The dialog makes duplicate local clones indistinguishable and can unintentionally clear account assignments for repositories added while it is open.

2 open issues
What changed in this PR

Adds bulk management of local repository account associations to GitHub Desktop’s Account settings, without changing Git remotes or author details.

Changes:

  • Adds a searchable repository-selection dialog with bulk assignment and unassignment.
  • Opens the dialog from account actions or after adding a previously unknown account with tracked repositories.
  • Redesigns Account settings and adds store, sign-in, and UI regression coverage.
File Description
app/​test/​unit/​ui/​preferences-accounts-test.tsx Tests account ordering and action menus.
app/​test/​unit/​ui/​manage-account-repositories-test.tsx Tests selection, filtering, errors, and empty states.
app/​test/​unit/​ui/​invalidated-token-test.tsx Updates recovery coverage for the Add account menu.
app/​test/​unit/​stores/​app-store-accounts-test.ts Tests post-sign-in prompts and bulk assignments.
app/​test/​unit/​repositories-store-test.ts Tests bulk persistence and account-scoped metadata.
app/​test/​unit/​account-repositories-test.ts Tests host filtering, selection, and assignment rules.
app/​styles/​ui/​dialogs/​_manage-account-repositories.scss Styles the repository-management dialog.
app/​styles/​ui/​_preferences.scss Styles the redesigned account list and actions.
app/​styles/​ui/​_dialog.scss Includes the new dialog styles.
app/​src/​ui/​repository-account/​manage-account-repositories-dialog.tsx Implements the searchable bulk-assignment dialog.
app/​src/​ui/​preferences/​preferences.tsx Connects Account settings to the new flows.
app/​src/​ui/​preferences/​accounts.tsx Adds host-sorted accounts and contextual actions.
app/​src/​ui/​dispatcher/​dispatcher.ts Exposes dialog, sign-in, and assignment operations.
app/​src/​ui/​app.tsx Renders the dialog with current local repositories.
app/​src/​models/​popup.ts Defines the new popup type and account payload.
app/​src/​lib/​stores/​repositories-store.ts Persists multiple assignments in one transaction.
app/​src/​lib/​stores/​app-store.ts Coordinates sign-in prompts and bulk updates.
app/​src/​lib/​account-repositories.ts Defines repository selection and account-change logic.

Review effort: Balanced

Comment on lines +119 to +121
<span className="account-repository-full-name">
{repository.gitHubRepository.fullName}
</span>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We're holding off on showing the full local path until users tell us identical rows are actually a problem. Repository aliases should already let people tell clones apart in most of these cases. The other review comment, about selecting repositories that are added while the dialog is open, is fixed in #23254.

Auto-replied by the GitHub Copilot app

isSubmitting: false,
error: null,
}
}
NitramO-YT pushed a commit to NitramO-YT/Github-Desktop that referenced this pull request Nov 25, 2026
The production compile now peaks just above the 4 GiB V8 heap limit,
causing intermittent out-of-memory failures in CI (desktop#23223) and locally
(desktop#23217).

Co-authored-by: Copilot App <[email protected]>
(cherry picked from commit 3d25f25)
cooldashing24 pushed a commit to cooldashing24/github-desktop that referenced this pull request Nov 26, 2026
The production compile now peaks just above the 4 GiB V8 heap limit,
causing intermittent out-of-memory failures in CI (desktop#23223) and locally
(desktop#23217).

Co-authored-by: Copilot App <[email protected]>

@tidy-dev tidy-dev 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.

💖

@niik

niik commented Dec 1, 2026

Copy link
Copy Markdown
Member Author

Thanks for the review! We're taking the remaining review comments (default-selecting repositories that arrive while the dialog is open, and showing local paths to distinguish duplicate clones) to a follow-up PR.

@niik
niik merged commit 20877b8 into development Dec 1, 2026
28 of 31 checks passed
@niik
niik deleted the niik-manage-repositories-for-account branch December 1, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-deep-review Requires in-depth human code review of affected paths; agent review is not sufficient.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changes diff re-renders each time you select/deselect a line

3 participants