I have a private repo on GitHub that I've checked out using GitHub Desktop and then opened as a folder using Visual Studio Code. I receive repeated prompts for my GitHub username and password. If I cancel out of the dialog, it comes back about 5 seconds later. If I enter my credentials, it goes away for a slightly longer period of time but still comes back. It should be possible to make the dialog go away and stop bothering me.
I'm running Visual Studio Code 1.12.1 on Windows 10 Anniversary Update.
I have the same issue. Is there any update on this?
I'm surffering the same issue. It occurs at leaast 1 time per minute after the last VS Code update
Not sure if this is related or not, but just in case: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/429
Thanks @eamodio. We've seen that too over here, and it really seems unrelated to Code. It just happens to surface quite often in it since Code does a periodic fetch. Let's see what comes out of Microsoft/Git-Credential-Manager-for-Windows#429
@joaomoreno can you elaborate as to why VSCode is doing a periodic fetch? The prompt seems to surface every 3-4 seconds after closing.
@dend I believe it does it to provide the status in the status bar about the upstream state -- are you in sync or not, and if not how many commits up/down. It might also be checking for other things as well.
@eamodio so is this the functionality controlled by:
// Whether auto fetching is enabled.
"git.autofetch": false
@dend I assume so -- but I don't know for sure
@joaomoreno @eamodio disabling autofetch removed the prompt altogether, so partially solved my problem.
Is there any other ways to overcome that without disabling autofetch?
Yes, setup a credential manager.
@joaomoreno Do you have a handy link for how to do that? :)
Sure.
This issue has been closed automatically because it needs more information and has not had recent activity. Please refer to our guidelines for filing issues. Thank you for your contributions.
Still happens in the latest version
Happens for the first time for me after update to 1.16.0 this morning.
Also keeps happening for me and two other friends who use vscode. Took us some time to figure out it's related to VSCode and not anything else.
@joaomoreno that really isn't helpful. From the README in the github repository:
How to use
You don't. It magically works when credentials are needed. For example, when pushing to Visual Studio Team Services, it automatically opens a window and initializes an oauth2 flow to get your token.
Clearly isn't working magically right now for me. And there isn't a setup guide, as it is supposed to "work magically" as software always does.
Mentioning everybody who claimed to have been affected: @dgolub @fexybob @gedean @svhero658 @inkredible-raccoonbot @mausworks
After getting VSCode yesterday, discovering this problem earlier this morning, and managing to MacGyver together the bits and pieces on the matter, I think I've found the way to permanently remove those popups (at least on windows, although I assume the process should be similar on OSX/*nix) in 2-3 steps.
1) open cmd, and do "git config --global credential.helper wincred" (this worked when git was in my path. I don't THINK having git in the path is actually necessary though, as long as your prompt can see it from your current directory)
2) If you already have commits to push or updates to pull, skip this step. Otherwise, do some minor change to a piece of code, I did it with a comment that just said "testing". Save, Stage, Commit.
3) back to cmd. for this part I recommend you have git in path because... screw it... git in your path is convenient as hell. whether you have commits to push or updates to pull (you know what you need) cd to the repository you wanna sync, and type "git
VSCode should stop with the popup, the git CLI will stop asking for credentials on every use, and life will go on with one less source of obnoxious interruption.
This has worked on 2 windows 10 machines (1 desktop, 1 tab-top) and (once I get back to work in the morning and test) MOST LIKELY a windows 7 laptop. I did not need the Git Credential Manager for Windows (third-party) OR to disable the autoFetch option.
P.S. Sorry if I'm really wordy. I prefer verbose instructions than the tl;dr versions that aren't clear enough to be helpful. It's also partially because the sensation of typing is calming to me.
This issue just started for me immediately after updating to 1.16.1
microsoft the idiots of all time.
DigitalNTT-Soul solution worked for me
git config --global credential.helper wincred
@r3wt Saying this is microsoft's fault is like blaming the NBA for NFL players not standing for the national anthem anymore. Microsoft has nothing to do with this. GitHub intentionally doesn't record the username and password whenever you try and perform a secured Git action. Therefore, every time VSCode attempts to perform those actions, Git asks for credentials, and VSCode's like "That's above my paygrade." and asks you. That's why the only long-term solution is telling Git to check the wincred vault before asking the Command Line (i.e. user/VSCode) for credentials. Hense the fix I shared. Which, regrettably, has only half as many thumbs up as your comment has thumbs down :/
@DigitalNTT-Soul I want to have my cake and eat it too. getting a damn credential prompt every 5 seconds is very irritating, hence my comment. to add insult to injury, there's no indication given to the user as to why. Overall VSCode is a good editor, but it drops the ball in very important areas that make it a frustrating result for end users who just need to get their work done and not worry about the editor going schizo.
It's moot anyway. whatever caused the bug has now subsided (for me personally, despite 0 intervention on my part). i look for it to rear its head eventually again, and likely to never be fixed.
So what can VSCode do to fix the issue?
Add a notice at the top of VSCode to suggest using the Microsoft git credentials manager? With a 'yes'/'no'/'dont ask agajn'
That seems plausible enough. However, VSCode is available on more than just Windows. I suppose VSCode could 1) determine what OS it's installed on, and 2) ask to use the native credential manager (*nix might be a little harder, because of the likelihood that different distros may have different managers; Perhaps have VSCode provide a link to some suggested Linux managers?). 3) if the user agrees to use the native (or selected) manager, VSCode would automatically register those credentials with the manager, and perform the terminal command to set that manager as git's "credential.helper". That would most certainly make the process smoother for windows/mac users. I have only ever had the pleasure of (knowingly) using 1 Linux desktop distro in my life, and it's been quite some time, so I can't even imagine how devs might approach that.
The GCM accepts several configuration settings, one of them turns of interactivity. If you're confident that you do not want to see the prompts you can set git config credential.interactive never and the GCM won't ask. However, if you do not have valid credentials set the authentication will just fail. Please note that altering the git-config will affect Git from the console as well.
Another option, and I'm not certain this is possible, is to have VSCode inject an environment variable on your behalf which tells the GCM to not prompt when VSCode is asking. This can be done by setting GCM_INTERACTIVE to NEVER.
Combining the GCM flag to not delete credentials, even when they appear invalid GCM_PRESERVE_CREDS=TRUE, could go a long way towards resolving these issues.
VSCode could get smarter and attempt the network operation a few times, before giving up and issuing the Git command without the suppression environment variables, thus allowing the GCM to actually present the dialog to acquire valid credentials.
Ideally, this would avoid the flaky network causing credential deletion scenario.
All, please be aware that this behavior we're seeing in this thread is "normal" and part of the Git specification. All parties are abiding by the git-credential contract as specified. However, since VSCode makes Git's network operations trivial to execute and even automates them, it's finding weaknesses in Git's refusal to allow transient network interruptions to go unnoticed.
This problem happens on Mac as well, and it does not respect if I answer "Allow always" <-- altho it should indicate, that I allow it to remember it and do not want to be asked again.
This is a bug in VS Code and configuring compters own git or setting specific flags for project settings is not the correct and sustainable answer here. Then it will happen with everyone who starts using it!
Most helpful comment
@eamodio so is this the functionality controlled by: