Skip to content

Multi user - #41

Closed
garethedwards-tass wants to merge 15 commits into
desktop-plus:mainfrom
garethedwards-tass:multi-user
Closed

garethedwards-tass wants to merge 15 commits into
desktop-plus:mainfrom
garethedwards-tass:multi-user

Conversation

@garethedwards-tass

Copy link
Copy Markdown

Multi user support

@pol-rivero
pol-rivero self-requested a review December 29, 2025 08:28
@pol-rivero
pol-rivero marked this pull request as draft December 29, 2025 08:28
@pol-rivero

Copy link
Copy Markdown
Member

I'll be watching this PR with great interest!

Feel free to mark the PR as ready (non-draft) once it's ready for review.

@pol-rivero pol-rivero linked an issue Dec 29, 2025 that may be closed by this pull request
@ghedwards

Copy link
Copy Markdown

I'm passing "login" around a bit in an attempt to use it to find the appropriate account, but I've recently realized I could probably use account@ prefixes on the github URL's quite effectively, a lot of the git CLI stuff is working, but github API stuff is not

@pol-rivero

Copy link
Copy Markdown
Member

@ghedwards I think passing the username around is probably the right call, since the account@ prefix might not be reliable, especially when cloning with SSH instead of HTTP.

Comment thread app/src/lib/stores/accounts-store.ts Outdated
Comment on lines +101 to +117
const multipleLoginAccounts = enableMultipleLoginAccounts()

try {
const key = getKeyForAccount(account)
await this.secureStore.setItem(key, account.login, account.token)
} catch (e) {
log.error(`Error adding account '${account.login}'`, e)

if (__DARWIN__ && isKeyChainError(e)) {
this.emitError(
new Error(
`GitHub Desktop was unable to store the account token in the keychain. Please check you have unlocked access to the 'login' keychain.`
)
)
} else {
this.emitError(e)
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wouldn't it be better to just call storeAccountKey?

Comment thread app/src/lib/stores/app-store.ts Resolved
@garethedwards-tass

garethedwards-tass commented Dec 30, 2025 •

Copy link
Copy Markdown
Author

Basics appear to be working ( I was reasonably far off earlier ), probably not ready for end users, but might be ready to have a look, and maybe even run through some workflows to see what works and what doesn't. I suspect backward compatibility with stores and manual / URL cloning might not work very well at the moment.. @pol-rivero

@ghedwards

Copy link
Copy Markdown

I've put the "login" in text () next to the grouping by "owner", @pol-rivero what would you do with repositories that don't currently have a specific user assigned, force the selection of an account on import, but then that doesn't fix existing repo's, maybe in this case just expect a user to delete and re-import ?

image

@pol-rivero

pol-rivero commented Dec 31, 2025 •

Copy link
Copy Markdown
Member

I think the best way to handle imported repositories would be:

  1. When importing, attempt to automatically detect the correct account:
    • If there is exactly 1 account with this endpoint, use that account.
    • If there are 2+ accounts with this endpoint and one of them is the owner, use that account.
  2. If there are no accounts with that endpoint, don't ask for an account and just import it as a regular repository (as usual)
  3. If there are 2+ accounts with this endpoint and none of them is the owner, show an account selector. The user should also be able to not link any account.

Additionally, in the repository settings (probably in the Integrations tab) there should be an option to change the linked account.

@ghedwards

Copy link
Copy Markdown

"as usual" would imply using the first account that matches the endpoint ( ie. github.com ) ? not link an account, not sure I follow, whats the use in doing that ? the current system would just find the first account ?

@pol-rivero

pol-rivero commented Dec 31, 2025 •

Copy link
Copy Markdown
Member

Sorry, I was a bit vague there.
What I meant is: when importing a repo belonging to an endpoint that has no accounts, the repo should not be linked to any account, and it should behave like a non-github repo (with only basic functionality).

Edit: Regarding this:

the current system would just find the first account

My point is that we should not use the first account. If the account to use is ambiguous (that is, there are 2 or more accounts, and none of them is the owner), we should show an account selector with all the candidates (accounts with the same endpoint as the repo) and let the user decide.

@ghedwards

ghedwards commented Dec 31, 2025 •

Copy link
Copy Markdown

Just got to a point where I believe 'login' is kept up to date across the repository and the githubRepository, it generally can be undefined or empty string so it should cater for what you're talking about. It could just get a bit confusing as people add accounts... anyway, in a reasonably good place, but I go on holiday in a few days so I was hoping to get the code somewhere others can maintain it, maybe create a new branch and I can send the PR there ? and then maybe make me a maintainer ?

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.

Ability to add multiple Github accounts

3 participants