Visual Studio asks me to sign in every time I push or sync

I’m using Visual Studio Enterprise 2017 on Windows 7 Pro 64-bit, and have Git version 2.17.1.2 installed.

I have two problems using this setup, and was hoping someone can help…

  1. I have a project hosted in GitHub, and ahve connected VS to it, so I can commit changes. However, every time I close VS, it seems to forget that it was connected to gitHub. Next time I open the project, it shows it as not being under source control.

If I click the “Add to source control” button on the VS status bar (bottom-right of the window), it shows Git as an option, and if I choose that, it reconnects correctly. Anyone know why I need ot do this? I’m used to working with SVN, and I never have to do this, VS always knows it’s under source control.

  1. Probably conencted to the above, whenever I want to commit code, it asks me to sign in to GitHub, following which I get an email telling me “A personal access token has been added to your account”

Even more annoying is that once I’ve logged in and committed, if I do another commit later (same VS session), it asks me to log in again and sends me another email.

Anyone know why it does this? Why doesn’t it remember my log-in details?

Thanks for any help.

Quick question for clarification… which plugin are you using? and are you using GitHub.com or GitHub Enterprise?

You may also want to take a look at the last section of this page - https://github.com/github/VisualStudio/blob/master/docs/getting-started/authenticating-to-github.md#personal-access-tokens

which describes how to create and use a Personal Access Token manually - 

What happens when you commit and push from the command line?

Not using a plugin, I’m accessing GitHub via Team Explorer. This was the only way I could work out how to get VS to talk to GitHub.

And it’s the plain GitHub, not enterprise.

Thanks for the response.

Thanks for the link. I’ve never used the command line, I do everything via VS, and would like to keep it that way if I can.

Can I use a personal access token from VS?

Thanks again

I believe you can use the personal access token in place of the password field - I found an old issue on GitHub relating to Visual Studio Professional which appears to be related - which is a Visual Studio bug (now showing as fixed) - it is definitely worth a try… 

https://github.com/github/VisualStudio/issues/1474

It is also suggested as an “option” here

https://github.com/github/VisualStudio/blob/master/docs/getting-started/authenticating-to-github.md

Let me know if you have any luck

Thanks for the reply. Unfortunately neither of those links helped.

The first one seemed to be about why he was being asked for a token instead of a password. UNless I misread it, he wasn’t asking why he was asked at all, which is my question. I just want VS to remember my credentials (like SVN does), so I don’t have to sign in each time I want to commit.

The second link looked more promising, but didn’t match what I see in VS. When I look at Team Explorer and click Manage Conenctions, all I see are my three GitHub repositories. I don’t ahve anything that allows me to connnect to GitHub or sign in. I poked around in all the nooks and crannies in that window, but there’s nothing there like that…

You can see it only shows my repos, and if I click Manage Connections, I only have the option to connect to another project.

Thanks again for the help. Any other ideas?

Digging around I see many similar problems with Visual Studio for Mac - that have been reported as fixed - I’m guessing you have done a similar trawl of the forums :frowning:

Aside from the standard “turn it off and on again” recommendation (basically uninstalling and re-installing) my only suggestion would be to take a look at this

https://github.com/Microsoft/Git-Credential-Manager-for-Windows 

and 

https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/Docs/Faq.md

It would be interesting to see if git, when used from the command line, behaves the same way. 

I also found this article https://agilewarrior.wordpress.com/2017/09/25/how-to-setup-git-credential-store-in-windows/ which may prove useful.

Are you using credentials manager? is TFS plugged into corporate Active Directory?