5

I'm using vscode and git. But I don't want to publish my codes to github. VScode still keeps popping up a windows to ask me to login on github. How to disable this?

Neo
  • 1,031
  • 2
  • 11
  • 27
  • Does this answer your question? [Remove git integrations from VSCode](https://stackoverflow.com/questions/30331338/remove-git-integrations-from-vscode) – VietDD Jun 30 '20 at 01:40
  • @VietDD Nope. I don't want to disable git. I still want to use a local git repo. I just don't want to push to github. – Neo Jun 30 '20 at 02:06
  • I think you just need to login once, then VSCode will store your credentials, popup will not show up again anymore, then push code to github or not, it depend on you. – VietDD Jun 30 '20 at 02:19
  • @VietDD Not true. I tried long before. But it keeps asking me to login again and again. – Neo Jun 30 '20 at 09:51

3 Answers3

6

Go to File > Prefrences > Settings (ctrl + ,) and search for: gitAuthentication

Uncheck both of these settings:

  • Git: Terminal Authentication
  • Github: Git Authentication

This will stop the popup as well as stop prompting for a username/password when running git command from the terminal.

Alternatively, you can add these lines to your settings.json file:

{
    // ...
    "github.gitAuthentication": false,
    "git.terminalAuthentication": false
}
John Pope
  • 81
  • 1
  • 2
  • Thanks, this issue has been bugging me for quite a while. I made the configuration changes from the UI but they did not take effect until I restarted VS Code. It might have been that I needed to close the terminal and create a new one. – a2f0 Jul 08 '23 at 13:12
5

While reading the link in the first comment, I saw this:

// When enabled, commits will automatically be fetched from the default remote of the current Git repository.
"git.autofetch": false,

I looked through Settings > Extensions > Git and saw Autofetch was enabled with a blue line, indicating it was not the default setting. I reset it and now I don't get popup anymore.

The reason I was getting the popup is because my repositories are private, and the login windows aren't "saving" my login, so every 180 seconds from launch, VSCode would try to access my online gits then get denied and ask me to login for each repository again.

Megame
  • 51
  • 1
  • 3
  • This would not work if you `want` to update your (private) repository on a different provider (like Bitbucket for instance). While this popup constantly wants to log you in on Github/Microsoft. If your Git settings are correct, for which ever remote you use, the autofetch should not be an issue, IMHO. – Ray Oei Feb 02 '22 at 08:58
0

It took me a while to find this as I experienced the same annoying thing which, in some cases, when multiple project were open, would drive the CPU to high loads. Anyway....

Go to settings (shift+CMD+P MacOS) and search github authentication. Remove the checkbox for Controls ... enable automatic Github authentication.. and VSCode should stop popping up the Github/Microsoft login.

Ray Oei
  • 1,827
  • 1
  • 17
  • 21