Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant sign in to multiple accounts on git desktop #9899

Closed
JohnnieBlinx opened this issue May 30, 2020 · 20 comments · Fixed by #9920
Closed

Cant sign in to multiple accounts on git desktop #9899

JohnnieBlinx opened this issue May 30, 2020 · 20 comments · Fixed by #9920

Comments

@JohnnieBlinx
Copy link

Describe the bug

Cant log in to any other account. Browser is opened and auto signs me in with no page loading for me to change the account

Version & OS

Windows 10
Git Desktop 2.5.0

Steps to reproduce the behavior

  1. Already logged in to git account
  2. Sign out
  3. Enter details of 2nd account and click sign in

Expected behavior

Account signs in

Actual behavior

Chrome opens even though i didnt click sign in with browser, a blank page opens with a giturl with no UI to interact with. Alert pops up (Open git desktop)

Click open git desktop and it signs me back into account #1 not the one ive just entered

@codenameone
Copy link

This is happening to me too. Retrying (signing in again) produces the desired result. Notice that this only happens if account 2 is not the one signed in on the browser. So now if I go back to account 1 it works the first time around.

This seems to be related to #9231

Honestly, I think the best solution is to finally support multiple account signin so we won't have to type the password over and over. If that would work it would be the best way.

@johnsiilver
Copy link

I'm having the a similar issue.

If I attempt to sign out and back in with another account, strange things occur (never the desired behavior).

Sometimes after I try and sign in, it opens in Edge beta (default browser) with a URL and then a blank page. If I try to auth with the browser, does the same thing. If I restart the app, then I can auth sometimes (hit or miss).

But, if I get signed in, one of two things will happen (neither a good result):

  • While it shows the right account, it doesn't let me access my repos, always an auth failure
  • Even though I logged in with one account, it will actually log me back into my other account (and display that name).

What I think is happening is that it really never changes the user context. No matter what it shows if I auth, I am in my other auth context.

@JohnnieBlinx
Copy link
Author

I have to open chrome, go to git, sign out and then change accounts in git desktop.

I dont see why youd have the option 'sign in with browser' because when you DONT click that it still opens the browser to sign in

@billygriffin
Copy link
Contributor

Sorry for the confusion. I think @codenameone's hypothesis might be correct that this could be related to the work in #9231. @rafeca Do you know if anything might have changed that would affect this?

Also for those in this thread, have you seen this specific issue before? The primary sign in method used to be username/password, but we're shifting to browser-based authentication because username/password auth will be deprecated on the API side. So I'm curious if this problem always existed but wasn't surfaced because everyone was just typing in username/password directly and only surfaced because more people are using the browser auth flow now, or whether this is something entirely new.

@codenameone
Copy link

@billygriffin this worked smoothly for me until last week or the week before that. I didn't see this before that and used that feature a lot.

@rafeca
Copy link
Contributor

rafeca commented Jun 2, 2020

Hey everyone! apologies for the issue: I did some changes recently to the auth flow, that could have caused the unexpected behaviour.

From the report, it seems like the issue is located in the account tab on the preferences dialog (not on the welcome flow that appears the first time Desktop is opened), is that right?

I've gone through the dialog and could find an issue which causes the browser authentication mechanism to get started when pressing "enter" on the keyboard after typing the user and password, is this the issue you're experiencing? I've tried reproducing the issue when clicking the "Sign in" button but this seems to work correctly.

Can somebody confirm that the issue is happening only when pressing "enter" on the keyboard? otherwise some specific repro steps would help me a lot investigate the problem.

@codenameone
Copy link

Yes, it's happening there (in Preferences window). I think you're right, it's related to the enter key. I just tried with the mouse several times and it didn't happen then with the enter key it did.

@rafeca
Copy link
Contributor

rafeca commented Jun 2, 2020

Yes, it's happening there (in Preferences window). I think you're right, it's related to the enter key. I just tried with the mouse several times and it didn't happen then with the enter key it did.

Thanks for the information! I've investigated further and it looks like this issue has been present for a while, but it's possible that the previous layout of the modal didn't persuade users to press "enter" while on the user/password inputs. I'm preparing a fix for this.

@codenameone a little bit offtopic but I saw you mentioned this:

Honestly, I think the best solution is to finally support multiple account signin so we won't have to type the password over and over. If that would work it would be the best way.

From what I understand, you often signout/signin using user/password to switch between different GitHub identities. Something worth to mention is that in the near future we're going to remove the user/password authentication mechanism and only keep the browser-based one, which can make it trickier for you to switch between accounts (you'll need to switch accounts on your browser first).

Can I take the opportunity to ask you what's your use case for switching between GitHub accounts, how often do you do it and how do you decide to use one account or another (is it based on the repository you're working)? Also, how do you normally manage the accounts on github.com? do you have multiple browsers each of them logged in with a different acount?

Thanks!

@codenameone
Copy link

@rafeca I need to support customers who have their own private repos and don't want commits from a 3rd party user. So I need to login using their private user account. Usually I only support one or two such accounts. In that case I have the main Codename One account logged in on firefox and the current customer account in chrome. This is annoying but it solves the hassle of logging in/out all the time.

Unfortunately github desktop always sends me to firefox so it doesn't work well for my current use case. This can be solved in the web UI by doing something similar to what Google did for multiple accounts where you can have all of them and just pick which one you want to use right now.

As a former consultant I can say this use case is very common...

@rafeca
Copy link
Contributor

rafeca commented Jun 2, 2020

Thanks for the context @codenameone !

You can take a look at #3707 to see the discussion about supporting multiple accounts. It's unlikely though that we're going to implement such support in the near future since this is a quite complex feature to implement and GitHub policy encourages a single account per user (see @billygriffin's comment). I'm open though to potential small tweaks to the signin process that could make switching between accounts a bit easier.

@johnsiilver
Copy link

I'd like to add a couple things here:

My use case is simple: I work for Microsoft and have to use two accounts, one for my personal work and one for my job as I "bring my own device" for work.

I would love to leverage a simple solution to this with little code change, like being able to have different copies of github desktop to support different accounts. If each instance would keep separate login credentials within its own tree instead of a global location.

I would note that by leveraging the browser for auth in the future instead of builtin to the app, this kind of functionality will be too painful to add in the future.

@mechu1205
Copy link

Can't believe that devs are actually aiming to intentionally leave this issue unsolved.

@SpectrumNox
Copy link

SpectrumNox commented Jun 30, 2021

Supporting multiple GitHub accounts in GitHub Desktop is a wonderful idea. A reopen would be much obliged~

@julianhatwell
Copy link

So I logged out of my personal repo to do something on my work repo and now I can't get back into my personal repo because the browser opens and automatically logs me in to my work repo with no dialogue or options. Am I reading correctly that this is intended behaviour?

@Dan-TEALS
Copy link

I can't believe this either. I have a repo on my machine that I can't push to my personal account because Windows 11/GitHub Desktop keep opening the login dialog in Edge and signing me into my work account. This is COMPLETELY unacceptable. Looks like it's time to find a new VCS.

@JohnnieBlinx
Copy link
Author

As i mentioned in my comment above somewhere the solution for this that worked for me is to go to git in the browser, log out, then try to sign in with git desktop. itll then do sign in with browser and you sign in with whatever account you want

@Dan-TEALS
Copy link

Hi JohnnieBlinx! You're right. You can force Windows 11 to log in to another account, if you sign out of your account in Github Desktop, log in to the desired account in the browser that Windows is going to open by default to do the browser sign-in (usually Edge but make sure you have the right account on the browser, too), then sign in on Github Desktop. It'll open the browser, not give you any choice of which account to use (but you've forced its hand by already being signed in on the browser), and then connect to the correct account in the Github Desktop. It's ridiculous that you have to do that work-around but it is better than deleting the account association in the Windows settings if you want to change accounts. Thanks!

@peidj23
Copy link

peidj23 commented Mar 9, 2022

GitHub policy encourages a single account per user (see @billygriffin's comment).

@rafeca

There is a very strong reason for supporting multiple Github accounts that I have not seen raised: government ethics.

I work for a state university. I also own a business with my wife. I have a github account for each, and they must be separate. It is highly unethical for me to use state resources for any private enterprise, so it is incredibly important to keep everything separate. I can actually face significant fines if I were found to be using my state issued identity to support my private business.

I strongly encourage you to reconsider your emphasis on having a single identity within the github ecosystem. The intent there is noble, but in practice we all have various reasons for wanting to compartmentalize different parts of our lives.

@MMO-Indie
Copy link

MMO-Indie commented Jun 10, 2022

Hi, like everyone else I started using the desktop because I find it cool but the fact that it's not multi-account I find really boring, so I wrote a small bat file to switch between 2accounts ( it's very easy to use, but does the job), I'm too lazy to make a GUI lol

GithubDesktopAccountSwitcher.bat
`
tasklist /fi "ImageName eq GitHubDesktop.exe" /fo csv 2>NUL | find /I "GitHubDesktop.exe">NUL
if "%ERRORLEVEL%"=="0" taskkill /F /IM GitHubDesktop.exe
md "%AppData%\GitHub Desktop-Temp"
md "%AppData%\GitHub Desktop-OtherAccount"
Xcopy "%AppData%\GitHub Desktop" "%AppData%\GitHub Desktop-Temp" /E /O /X /H /K /Y

set "DIR_TO_DELETE=%AppData%\GitHub Desktop"

Xcopy "%AppData%\GitHub Desktop-OtherAccount" "%AppData%\GitHub Desktop" /E /O /X /H /K /Y

set "DIR_TO_DELETE=%AppData%\GitHub Desktop-OtherAccount"

Xcopy "%AppData%\GitHub Desktop-Temp" "%AppData%\GitHub Desktop-OtherAccount" /E /O /X /H /K /Y

set "DIR_TO_DELETE=%AppData%\GitHub Desktop-Temp"

IF EXIST %DIR_TO_DELETE% (
FOR /D %%p IN ("%DIR_TO_DELETE%*.") DO rmdir "%%p" /S /Q
del %DIR_TO_DELETE%*.
/F /Q
)`

@Clicketyclick
Copy link

A bit simpler and more clean use of multi profile switch: https://gist.github.com/AnvithLobo/7714a7f6cb1729adc421832f8cf17f6f

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 a pull request may close this issue.

13 participants