Git push: Missing or invalid credentials. fatal: Authentication failed for 'https://github.com/username/repo.git'

ID : 131331

viewed : 5

Tags : gitgithubvisual-studio-codegit

Top 5 Answer for Git push: Missing or invalid credentials. fatal: Authentication failed for 'https://github.com/username/repo.git'

vote vote

97

You are trying to use git from a terminal in vscode. The problem comes from the authentication handler of vscode. To solve the problem:

  • Open vscode File > Preferences > Settings
  • Search for git.terminalAuthentication
  • Uncheck the option

You have to re-open the terminal to make it work.

As of March 2022, the menus have changed a bit. Here's an illustration of how to access them: enter image description here

enter image description here

vote vote

84

If you're on linux, just add sudo before the command. Otherwise, you have to add administration prefix to the command.

vote vote

77

As mentioned in marpo-it's answer, the setting git.terminalAuthentication can be unchecked (since VSCode 1.45)

setting

That will avoid that, for Git commands invoked in the Integrated Terminal, like git push for instance, you would automatically be authenticated against your GitHub account.


Original answer:

I have set up credentials by using git config user.name "your username" and git config user.password "your password", and could see these by running git config --list, what am I missing here?

Those are not "credentials": they won't help authenticate you to a remote service like GitHub.

For HTTPS URLS (https://github.com/<me>/<myRepo>), you would need to:

There you would enter your actual credentials:

  • your GitHub user account name
  • your GitHub user account password (or a PAT if you have 2FA activated)

But if the issue disappear today, then this was linked to this GitHub incident.


Andreas L also mentions in the comments that trying to authenticate from an integrated VS Code terminal can be tricky.
As detailed in "git push origin master Missing or invalid credentials", and here:

If you work with the JSON-settings file, insert the following line into it:

git.terminalAuthentication: false, 
vote vote

69

Reloading the VSCode window (shift-control-P to open the Command Palette then find Developer: Reload Window and press Enter) fixed this for me.

vote vote

59

I had a similar issue. I had to modify the git config as follows:

[credential]         helper = manager 

Before it was set to wincred.

Top 3 video Explaining Git push: Missing or invalid credentials. fatal: Authentication failed for 'https://github.com/username/repo.git'

Related QUESTION?