I'd like to remove the extra steps of having to log out, log back in, and do the 2FA each time I switch projects in VS2022. Any way around this? Seems like Windows saves one instance and that's it.
Asked
Active
Viewed 568 times
1 Answers
1
Visual Studio 2022 does have an integration with your Git Credenrial Helper
I recommend GCM Core, which comes with Git For Windows.
Your user account/token should then be preserved in the Windows credentials manager, and would not be asked again when you switch GitHub repositories.
The OP adds:
I have two separate GH accounts with a repo in each. When I switch between those two, that's when I need to sign out/in each time
You won't have to sign out/in each time if the remote URL includes your GitHub account:
https://yourGHAccount1@github.com/yourGHAccount1/yourProject
https://yourGHAccount2@github.com/yourGHAccount2/yourProject
Then the Git Credential Manager would ask your token for each account and cache those.

VonC
- 1,262,500
- 529
- 4,410
- 5,250
-
I've tried this but when I switch repos it still has the previous Github account signed in. I also probably wasn't very clear with my question. I have two separate GH accounts with a repo in each. When I switch between those two, that's when I need to sign out/in each time. – user3953989 Jul 04 '22 at 20:36
-
@user3953989 OK, got it. I have edited the answer to include a solution which will address that use case. – VonC Jul 04 '22 at 20:41
-
ty! With a little messing around with VS I was able to get it to work. If you use the above method and login to the first repo it will work but when you use VS to sign into the other account it will lose the creds for the 1st one. Once you re-enter them again it appears to stick. Thanks again! – user3953989 Jul 05 '22 at 02:54