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

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.


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


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:

  • use a credential helper (git config --global credential.helper osxkeychain)
  • update the credentials from the OSX Keychain

There you would enter your actual credentials:

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,