350

I started using Visual Studio Code, and I was trying to save my test project into GitHub, but Visual Studio Code is always asking for my GitHub credentials.

I have installed in my PC GitHub Desktop and also Git. I already ran:

 git config --global credential.helper wincred

but still Visual Studio Code is asking for the credentials.

How can I fix this?

Here is my .gitconfig file located in the user profile folfer:

    [filter "lfs"]
    clean = git-lfs clean %f
    smudge = git-lfs smudge %f
    required = true
[user]
    name = ddieppa
[user]
    email = fake@live.com
[credential]
    helper = wincred

Here is the popup windows asking for the credentials:

Enter image description here

I enter my GitHub credentials in the popup, but still getting this error in the Git output window in Visual Studio Code:

remote: Anonymous access to ddieppa/LineOfBizApp.git denied.
fatal: Authentication failed for 'https://github.com/ddieppa/LineOfBizApp.git/'
Joerg S
  • 4,730
  • 3
  • 24
  • 43
ddieppa
  • 5,866
  • 7
  • 30
  • 40
  • 1
    which GItHub URL you're using? a HTTP or GIT (SSH)? If you're using HTTP URL you must include the user and password in the URL. You better use the GIT URL and add your public SSH key in the user's SSH keys list – yorammi Dec 21 '15 at 16:51
  • @yorammi I am new working with git, so I installed Github Desktop and Git and try to save my project using Visual Studio Code, so I don't know what I am passing. How do I know that? – ddieppa Dec 21 '15 at 18:45
  • @ddieppa GitHub Desktop has a way to work with two factor authentication with a https connection. However, that breaks other tools. Like the answer said you need to now change the origin URL from https to ssh. – Lex Li Dec 22 '15 at 05:23
  • Several restarts might also help. I restarted my computer 2 times and then VS did not ask for credentials again. – Per G Sep 02 '21 at 08:40
  • 2
    Why is this tagged with Visual Studio? [Visual Studio](https://en.wikipedia.org/wiki/Microsoft_Visual_Studio) and [Visual Studio Code](https://en.wikipedia.org/wiki/Visual_Studio_Code) are two different things. – Peter Mortensen Nov 20 '21 at 20:56

32 Answers32

225

Why does Visual Studio Code ask for a password? Because Visual Studio Code runs the auto-fetch feature, while the Git server doesn't have any information to authorize your identity. It happens when:

  • Your Git repository has a https remote URL. Yes! This kind of remote will absolutely ask you every time. No exceptions here! (You can do a temporary trick to cache the authorization as the solution below, but this is not recommended.)
  • Your Git repository has ssh remote URL, but you've not copied your ssh public key onto the Git server. Use ssh-keygen to generate your key and copy it to Git server. Done! This solution also helps you never retype password on terminal again. See a good instruction by @Fnatical here for the answer.

The updated part at the end of this answer doesn't really help you at all. (It actually makes you stagnant in your workflow.) It only stops things happening in Visual Studio Code and moves these happenings to the terminal.

Sorry if this bad answer has affected you for a long, long time.


The original answer (bad)

I found the solution on Visual Studio Code document:

Tip: You should set up a credential helper to avoid getting asked for credentials every time VS Code talks to your Git remotes. If you don't do this, you may want to consider Disabling Autofetch in the ... menu to reduce the number of prompts you get.

So, turn on the credential helper so that Git will save your password in memory for some time. By default, Git will cache your password for 15 minutes.

In Terminal, enter the following:

git config --global credential.helper cache
# Set Git to use the credential memory cache

To change the default password cache timeout, enter the following:

git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)

If the original answer doesn't work

I installed Visual Studio Code and configuration same above, but as @ddieppa said, It didn't work for me too. So I tried to find an option in User Setting, and I saw "git.autofetch" = true, now set it's false! Visual Studio Code is no longer required to enter password repeatedly again!

In menu FilePreferencesUser Setting: Type these:

Place your settings in this file to overwrite the default settings:

{
  "git.autofetch": false
}
Davuz
  • 5,040
  • 13
  • 41
  • 61
  • 3
    I tried that, but didn't work for me, I even use this one: $ git config --global credential.helper wincred – ddieppa Jan 06 '16 at 17:18
  • While the autofetch solution does stop the constant popup problem, it still requires entering credentials on every push and pull. If using a PC with http/s, the credential manager solution below works great. – ruttopia Aug 24 '16 at 11:39
  • 3
    things should not pop up if you haven't initiated the action, especially things asking for credentials - how do you know this is safe and not a spoof? – Anthony Johnston Oct 08 '16 at 15:12
  • 7
    Be careful with that setting, please! It is not meant to help you remember your credentials at all. It is talking about automatically helping you git-fetch. Please have a look at https://www.atlassian.com/git/tutorials/syncing#git-fetch for more details on that. As far as storing your credentials is concerned, use the command `git config --global credential.helper cache`. Have a look at https://git-scm.com/book/gr/v2/Git-Tools-Credential-Storage for more details. – Grateful Mar 09 '17 at 09:47
  • 8
    Suggesting that you turn off autofetch is fine as a "leave me alone" option. But it is akin to saying "If your software doesn't work, just stop using it." It is important for people to realize the difference. I would suggest that the "UPDATE" part of this answer say "IF THAT DOESN'T WORK" instead, and explain that you can get it to stop bothering you without actually fixing the problem. The part of the answer above UPDATE is actually correct (at least, following the documentation link worked for me) – Don Oct 29 '18 at 15:32
  • It works for me, even without the updated part. I'm using VSCODE on a LinuxMint. – Akeel Faridee Feb 27 '19 at 03:20
  • @Don You're right! I updated my last answer about it. – Davuz Mar 05 '19 at 16:56
  • 2
    the https-part did it for me. Accidentally pointed origin to https instead of the ssh link, then wondered what had gotten into vs code xD – D. Veen Mar 10 '19 at 13:56
  • `git config --global credential.helper cache` solved my problem with wsl2 – Rick Love Mar 23 '21 at 22:00
163

This has been working for me:

  1. Set the credential helper to store:

    git config --global credential.helper store

  2. Then verify if you want:

    git config --global credential.helper

A simple example when using Git Bash quoted from here (works for the current repository only, use --global for all repositories):

git config credential.helper store
git push http://example.com/repo.git

Username: < type your username >
Password: < type your password >

[several days later]

git push http://example.com/repo.git

[your credentials are used automatically]

It will work for Visual Studio Code too.

A more detailed example and advanced usage is here.

Note: Username and passwords are not encrypted and are stored in plain text format, so use it on your personal computer only.

Vaibhav Vishal
  • 6,576
  • 7
  • 27
  • 48
  • 2
    I have no idea why this cache just wouldn't wanna work for me on ubuntu 18.04, and vs code. `store` did it. – D. Dan Oct 25 '18 at 14:54
  • 2
    very not safe. use the cache instead. if your "personal" computer gets hacked, your git credentials might get hacked too.. – Hypersoft Systems Jan 22 '19 at 15:51
  • 1
    cache saves credential in memory, it's not a long term solution. You won't have to enter username and password everytime, but still you will have to enter it quite often. – Vaibhav Vishal Jan 23 '19 at 04:37
  • 1
    I like this answer the best. I don't want to be prompted for username/password every time I push my code to the origin (i.e. GitLab) using VS Code – Sean McCarthy Jan 27 '20 at 22:22
  • I still argue that this method is unsafe. the creds are stored in ` ~/.git-credentials` file which can be abused when the system is compromised. Better change `https` to `ssh` and use ssh keys as an alternative. – Mohith7548 Mar 17 '20 at 05:07
  • I followed this method. git config --global credential.helper store. But now, if I wanted to change or remove my credentials. Where can I find the store? – Raja Parivesh Jan 22 '21 at 09:55
  • `~/.git-credentials` in Linux & Mac. Not sure about windows, but [this answer](https://stackoverflow.com/q/52216687/9321755) should help. – Vaibhav Vishal Jan 22 '21 at 10:03
  • Both command lines are the same: "Set the credential helper to store:" and "Then verify if you want:". – Raúl Salinas-Monteagudo Jan 20 '23 at 11:02
115

You should be able to set your credentials like this:

git remote set-url origin https://<USERNAME>:<PASSWORD>@bitbucket.org/path/to/repo.git

You can get the remote URL like this:

git config --get remote.origin.url
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
yohosuff
  • 1,359
  • 1
  • 11
  • 19
  • 7
    If I have the @ in my password then what will be the url? – Suvonkar Sep 08 '17 at 09:07
  • This is really nice way. One question though, where does those credentials saved in local file system? – Teoman shipahi Jan 05 '19 at 04:37
  • 1
    In the .git\config file. – yohosuff Jan 05 '19 at 05:09
  • 2
    also note that is optional, if you don't want to save your password to local disk and want to continue to be prompted for that. – Ben Barreth Mar 08 '19 at 15:40
  • 1
    You could also provision a personal access token to use for your password, this way you're not exposing your real account password presumably stored in plaintext. Also you can easily remove the provision if you want or if you thought your system is lost or compromised. – CTS_AE Apr 11 '20 at 21:19
  • 3
    @Suvonkar, you could have used %40 instead of @ in your password. – Mayur Saner Sep 04 '20 at 15:52
  • Building on @Mayur Saner's response to use special characters !#$&'()*+,/:;=?@[] in your username or password then URL encode them first – GerardBeckerleg Jun 21 '21 at 10:36
43

All I had to do was to run this command:

Windows: git config --global credential.helper wincred

Linux: git config --global credential.helper store

Then I was prompted for the password twice.

Next time it worked without prompting me for a password.

GoTo
  • 5,966
  • 2
  • 28
  • 31
  • 2
    Thanks! Problem solved, and [this one too](https://stackoverflow.com/questions/5989592/git-cannot-checkout-branch-error-pathspec-did-not-match-any-files-kn)! – Jeffrey Roosendaal Aug 30 '18 at 19:09
  • 9
    On Ubuntu, use `store` instead of `wincred`. – Cees Timmerman Oct 03 '19 at 10:00
  • 2
    This worked for me! You can also do e.g. `git config --global credential.helper 'cache --timeout==1209600'` to make it last for 2 weeks instead of the default 15 minutes. Source: https://help.github.com/en/github/using-git/caching-your-github-password-in-git – Andrew Mar 05 '20 at 21:40
  • 1
    ^ For more on this, see here: https://git-scm.com/docs/gitcredentials https://git-scm.com/docs/git-credential-cache https://git-scm.com/docs/git-credential-store `store` will store it permanently on the disk. Also, my previous comment has an error: don't use `==`, use `=`. Too late to edit. – Andrew Mar 18 '20 at 17:24
  • Please specify that this solution is for Windows only. – funder7 May 25 '22 at 15:42
  • @funder7 Is not Windows-only. Works fine on Linux when you use "store" instead of "wincred" – Klom Dark Feb 05 '23 at 23:36
  • @KlomDark I've added the linux version too. Thanks for your comment. – GoTo Feb 07 '23 at 15:22
  • 1
    @funder7 I've added the linux version too. Thanks for your comment. – GoTo Feb 07 '23 at 15:22
36

In general, you can use the built-in credential storage facilities:

git config --global credential.helper store

Or, if you're on Windows, you can use their credential system:

git config --global credential.helper wincred

Or, if you're on macOS, you can use their credential system:

git config --global credential.helper osxkeychain

The first solution is optimal in most situations.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Adam Erickson
  • 6,027
  • 2
  • 46
  • 33
34

The following steps walk you through how to:

  1. Generate SSH keys (without passphrase**)
  2. Add the public key generated in step 1 to your Git repository
  3. Confirm the above steps have been completed successfully
  4. Make your first commit (without having to provide a username / password)

**Generating SSH keys without a passphrase is unwise if your work is particularly sensitive.

OS - Fedora 28 | Editor - Visual Studio Code v1.23.0 | Repository - Git

Generate SSH keys:

  • ssh-keygen -t rsa -C "email@goeshere.com"
  • Enter file in which to save the key: Press Enter
  • Enter passphrase: Press Enter
  • Enter same passphrase again: Press Enter

After completing the above steps, the location of your public key is shown in the terminal window. If the currently logged in user is 'bob' the location of your public key would be /home/bob/.ssh/id_rsa.pub

Copy and import public key to GitHub:

  • cat /home/bob/.ssh/id_rsa.pub

  • Copy the whole public key that is now displayed in your terminal window to the clipboard

  • Go to https://github.com and sign in

  • Click the user icon in the top right corner of the screen and select Settings

  • Click SSH and GPG keys

  • Click New SSH key

  • Enter a title, paste the public key copied to the clipboard in the first bullet point, and click Add SSH key

Confirm the above steps:

  • ssh -T git@github.com

  • yes

  • Hi ! You've successfully authenticated, but GitHub does not provide shell access.

First commit / push without having to enter a username / password:

  • touch test.txt

  • git add test.txt

  • git commit - opens editor, enter a message and save the file. If vi is your editor, press I once the file opens, enter a message, press Esc, and then enter :x to save changes.

  • git push

The only hiccup you may encounter is when you attempt to SSH to GitHub. This link will provide some assistance -

Happy hunting!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Fnatical
  • 506
  • 5
  • 7
23

Try installing "Git Credential Manager For Windows" (and following instructions for setting up the credential manager).

When required within an application using Git (e.g., Visual Studio Code) it will "magically" open the required dialog for Visual Studio Team Services credential input.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Reddog
  • 15,219
  • 3
  • 51
  • 63
22

Use SSH instead of HTTP or HTTPS.

You will need to set SSH keys on your local machine, upload them to your Git server and replace the URL form http:// to git:// and you will not need to use passwords any more.

If you cant use ssh add this to your configuration:

[credential "https://example.com"]
    username = me

Documents are here.


Using an SSH key in GitHub


Simply follow these steps and you will set up your SSH key in no time:

  • Generate a new SSH key (or skip this step if you already have a key) ssh-keygen -t rsa -C "your@email"

  • Once you have your key set in home/.ssh directory (or Users/<your user>.ssh under Windows), open it and copy the content


How can I add an SSH key to a GitHub account?

And you are all set to go :-)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
  • 4
    You should also make it clear what is the root cause. In my case, since I have enabled two factor authentication, then SSH is the only way to connect to repos. Any https connection will lead to such prompt. – Lex Li Dec 22 '15 at 05:21
  • @codeWizard I don't recall exactly what happened but VS Code was working fine, I mean connecting to the GitHub repo without any extra configuration, I think maybe the issue was that I installed Git after Github Desktop, could that be possible? – ddieppa Dec 23 '15 at 12:05
  • VC might store its credentials internally and once you have re-installed/upgraded git the configuration might have been changed. Im not a VC user im a UNIX guy so i cant test it on my machine. – CodeWizard Dec 23 '15 at 12:47
  • 3
    @codeWizard VS Code is open source and multi-platform, you can run it on Windows, MacOS or Linux :), working on the ssh variant and see what I get – ddieppa Dec 23 '15 at 15:25
  • 1
    Link to documentation is broken. – Vishal Aug 11 '16 at 07:42
12

Automatic Git authentication. From the v1.45 Release Notes:

GitHub authentication for GitHub Repositories

VS Code now has automatic GitHub authentication against GitHub repositories. You can now clone, pull, push to and from public and private repositories without configuring any credential manager in your system. Even Git commands invoked in the Integrated Terminal, for example git push, are now automatically authenticated against your GitHub account.

You can disable GitHub authentication with the git.githubAuthentication setting. You can also disable the terminal authentication integration with the git.terminalAuthentication setting.

Mark
  • 143,421
  • 24
  • 428
  • 436
  • Great! Disabling these two setting on Linux (Ubuntu 18.04 + KDE Plasma) fixes credentials handling. These two enabled were overriding `askpass = /usr/bin/ksshaskpass` in my `.gitconfig` and as a result I was getting username and password asked every time. This will probably get upvoted more as version 1.45 roles out on more machines. – Andrei Sinitson May 11 '20 at 12:29
7

For Windows 10: go to Control PanelCredential managerWindows Credential → click on the Git link, → Edit → update to new password. That should work.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Meera
  • 71
  • 1
  • 1
  • A-ha! Another case where an expired/reset password causes mysterious problems and users to waste half a day. Thanks! – underscore_d Jul 16 '20 at 15:50
5

Ubuntu users should simply enter this command in the terminal of Visual Studio Code:

git config --global credential.helper store

Now, enter one time your username and password and after that, it won't ask you again.

Note:

  1. Username and passwords are not encrypted and stored in plain text format so use them with caution.

  2. But, if your password contains some special characters like @, #, &, * etc, then these characters will be encrypted.

Also, you can find your '.git-credentials' file at home. It's hidden, so make sure to enable hidden files.

Location: ~/.git-credentials

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Himanshu Verma
  • 131
  • 1
  • 10
5

I ran this on Visual Studio Code and Ubuntu 20.04 (Focal Fossa):

It automatically solved the regularly asking credentials problem:

git config --global credential.helper store
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tabraiz Malik
  • 106
  • 1
  • 6
  • this stores the user name and password in a plain text file. Not very secure. You can find that file at ~ /.git-credentials – Maurice Mar 22 '23 at 17:23
2

Use an SSH key without a passphrase.

Maybe this is obvious to some (wasn't to me). It also doesn't solve the issue if you absolutely require a passphrase, but this was a decent compromise in my situation on Mac.

2

After fighting with something like this for a little while, I think I came up with a good solution, especially when having multiple accounts across both GitHub and Bitbucket. However for Visual Studio Code, it ultimately ended up as start it from a Git Bash terminal so that it inherited the environment variables from the bash session and it knew which ssh-agent to look at.

I still really struggled to find one place to get the info I needed. Plus since 2017, ssh-agent got the ability to prompt you for a passphrase only when you try to access a repository.

I put my findings down here if anyone is interested.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ScubaManDan
  • 809
  • 8
  • 22
2

I usually run this simple command to change the Git remote URL from HTTPS to SSH:

git remote set-url origin git@github.com:username/repo-name-here.git
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ahmad Khudeish
  • 1,017
  • 13
  • 15
2

This is how I solved the issue on my computer:

  1. Open Visual Studio Code

  2. Go to menu FilePreferencesSettings

  3. Under User tab, expand Extensions and select Git

    Enter image description here

  4. Find Autofetch on the right pane and uncheck it

    Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
1

Following this article:

You may just set the GIT_SSH environment variable to PuTTY's plink.exe program.

(Then use the pageant.exe program as an authentication agent.)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Paul Paku
  • 360
  • 2
  • 16
1

I managed to stop this by carrying out the following steps.

  1. Uninstall GitHub Desktop (I am not sure this is necessary)
  2. Uninstall Credentials Manager: cd "C:\Program Files\Git\mingw64\libexec\git-core" followed by git-credential-manager.exe uninstall
  3. Reset the credentials helper to use wincred: git config --global credential.helper wincred
  4. Use Visual Studio Code to push some changes and reinput credentials.

NOTE: I was using a personal access token as my password.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Mick
  • 11
  • 1
1

Solve the issue by the following steps.

Uninstall software Visual Studio Code and Git and reinstall the same. Change the Git repository clone URL from SSH to HTTPS.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sundar
  • 655
  • 2
  • 7
  • 13
1

I had a similar problem in Visual Studio Code.

I solved it by changing the remote URL to https (in file .git/config):

[remote "origin"]
    url = https://user@server.com/plesk-git/project.git

And also:

git config --global credential.helper wincred

I pulled again, the Windows credentials popup came out, and the problems were solved.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Vland
  • 4,151
  • 2
  • 32
  • 43
0

For me, I had set up my remote repository with an SSH key, but Git could not find them because the HOMEDRIVE environment variable was automatically getting set to a network share due to my company's domain policy. Changing that environment variable in my shell prior to launching code . caused Visual Studio Code to inherit the correct environment variable and voilà no more connection errors in the Git output window.

Now I just have to figure out how to override the domain policy, so HOMEDRIVE is always pointing to my local c:\users\marvhen directory, which is the default location for the .ssh directory.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
marvhen
  • 314
  • 1
  • 3
  • 13
0

I solved a similar problem in a simple way:

  1. Go to CMD or Terminal
  2. Type git pull origin master. Replace 'origin' with your remote name
  3. It will ask for the credentials. Type it.

That's all. I solved the problem.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Avinash
  • 812
  • 1
  • 8
  • 22
0

For Windows 10:

  • Press the windows key.
  • Type cred and you should see "Credential Manager" in Control Panel
  • Click to open and then remove the related cached credentials. Then try again. It will ask for a user ID and a password. Key in the correct password and you'll be good.

It happened with me when I changed my network password.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

You can refer to this link to set up a Git credential.

You can run the following command to save your Git credentials. You do not need to enter a username and password every time the Git command runs (it’s for Windows):

git config --global credential.helper wincred

For Mac / Linux, see Git Credential Manager for Mac and Linux for how to save Git credentials.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Tejas Savaliya
  • 572
  • 7
  • 8
0

The opposite problem, but related:

In my case I was struggling with the Visual Studio Code integrated terminal not forgetting the entered password even though the cache helper timeout had expired already.

External terminal sessions were working fine, though.

I found there happens to be an option in Visual Studio Code which lets you set an optional cache on top of the actual Git plugin, which wasn't allowing the expected behaviour to occur.

Visual Studio Code preferences UI

Once checked, my passwords were being forgotten on cache timeout, so I could start jumping from personal to work accounts without any efforts :)

On Linux, and Visual Studio Code 1.58.2.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ian Sebastian
  • 390
  • 2
  • 8
0

(This answer is not specific to GitHub, instead I was using BitBucket, but it may work in GitHub too, because the concept is the same)

In my case I was using a Bitbucket app password and it always asked me to authenticate.

Stopping automatic fetch doesn't solve the problem because I pull and push several times in a day, and entering the app password everytime is just bad.

Furtermore, I would need to store the app password somewhere unsafe, which is also the reason that I don't want to use credential.helper store, that stores the password in plaintext, and instead use credential.helper wincred, which is encrypted.

When the dialog prompted me, instead of using the app password, I asked to sign-in using the browser, which worked, for reasons that are beyond my understanding. Now it doesn't ask for credentials anymore (I had to change my default browser temporarily, because the bitbucket account I use for work is not in my default browser, and the dialog try to authenticate using the default browser).

Lucas Basquerotto
  • 7,260
  • 2
  • 47
  • 61
0

This works for me. you only need to type in PAT once. git config --global credential.helper wincred

NikkiQin
  • 19
  • 2
0

We need to configure VS Code to provide authentication on top of Git commands.

Below I show how to set up the extension settings.

enter image description here

Maciej Skorski
  • 2,303
  • 6
  • 14
0

this may possibly happen when you are using an "https" address of git repository like https://github.com:TEST/PROJECT.git. you can fix this issue by replacing the https address with ssh address, by making a change on this file: PROJECT ROOT/.git/config you should change url and pushurl to the git one address.

-1

Apart from adding the SSH configuration entries above

If Windows

Set-Service ssh-agent -StartupType Automatic

In PowerShell.

Now Visual Studio Code should not prompt...

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ubreddy
  • 815
  • 2
  • 8
  • 19
-1

In case you are on a Windows PC, then install Git for Windows. That's it!

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Akshay Vijay Jain
  • 13,461
  • 8
  • 60
  • 73
-1

The user to open Visual Studio Code must be the same user to execute a Git command. Then in a terminal, run the following commands.

git config --global credential.helper store
git pull

In the next action push or pull, you will not see it asking for Git credentials.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131