34

A lot of us are currently having the issue where we aren't able to push changes to GitHub anymore and getting a fatal: Authentication failed for error. This has been observed on Linux.

This is because the newest version of Visual Studio Code (1.62.2) introduced this bug.

Is there a fix for this version, or otherwise a workaround?

9
  • 1
    I also got it on Linux (Ubuntu MATE 20.04 (Focal Fossa)). Is it restricted to Linux or not? Commented Nov 16, 2021 at 23:01
  • 1
    The full error message may or may not include "remote: No anonymous write access.". Commented Nov 18, 2021 at 16:23
  • 1
    Or "remote: Repository not found." Commented Nov 19, 2021 at 22:02
  • 1
    There is not even a question here. There is no detail on how you want to authenticate. No debug output like from ssh -vv
    – Robert
    Commented Dec 1, 2021 at 15:30
  • 2
    This question is being discussed on Meta. Commented Dec 2, 2021 at 18:17

8 Answers 8

45

To fix it, follow these simple steps:

  1. Go to your github profile settings
  2. Select Developer section and go to Personal Access token
  3. Create a new acces Token ( Copy it as soon as it has been generated )
  4. Then try to push some changes in your repository, you will be asked to put username and password
  5. For the password, just paste the access token you just copied
1
  • 1
    Today my GitHub connection just stopped working, although my PAT does not expire for many months. I had to use the "Regenerate token" button in GitHub and complete steps 4 and 5 again to get it working. Odd for the PAT to stop working before it expires.
    – swinn
    Commented Jun 21 at 1:45
12

Adding a username and password (personal token provided by GitHub) to the remote URL, resolved the issue for me.

  1. check the connected remote URL:

git remote -v

  1. set remote URL with credentials:

git remote set-url origin https://username:[email protected]/organization/repo.git

To generate your personal access token visit: https://github.com/settings/tokens

0
9

It is apparently covered by this issue, to be solved in 1.62.3.

The workaround is to unset Git: Terminal Authentication in the Visual Studio Code settings (menu FilePreferencesSettingsUserExtensionsGitTerminal Authentication).

Enter image description here

5
  • The workaround did not make any difference for me (I changed it in both "Workspace" and "User") - precisely the same error message. Commented Nov 16, 2021 at 23:24
  • Yes, for me it worked on one of my Windows PC, but neither in the other one nor on my Linux machine... I guess downgrading remains the best option.
    – mrgou
    Commented Nov 17, 2021 at 9:56
  • Here is an extended version. I haven't tried it (yet) - I went with downgrading Visual Studio Code to 1.62.1 to get it working again, but I may dig deeper later using a separate non-critical non-production environment. Commented Nov 18, 2021 at 0:29
  • I'm on 1.62.3 now and the issue has been resolved. Open up an issue in the VS Code GitHub repo so that they're aware of it
    – Adrian D.
    Commented Nov 22, 2021 at 0:06
  • Yes, issue resolved in 1.62.3, although be aware you have to restart the integrated terminal session, ie exit it, then start new terminal and not resume a previous session Commented Nov 23, 2021 at 4:36
9

The way I solved it was by downgrading it to 1.62.1, and now it works perfectly again.

I'm on Linux, so this may not apply or work for you, but it should if all Visual Studio Code versions are the same across all OSes.

The Visual Studio Code team has confirmed that it will be fixed on 1.62.3

If you use openSUSE Tumbleweed like me, you can run the following command in the terminal to downgrade:

$ sudo zypper install --oldpackage code-1.62.1

7
  • 1
    Where do you get older version of visual studio code?
    – Bogdan
    Commented Nov 15, 2021 at 23:14
  • @Bogdan You'll have to look up how to do it on your specific operating system.
    – Adrian D.
    Commented Nov 16, 2021 at 1:33
  • 1
    As this question is becoming the canonical question for this Visual Studio Code scandal, perhaps cover more Linux distributions/package managers (with specific instructions)? DT recently made the video "How to downgrade packages In Debian and Arch Linux". Commented Nov 17, 2021 at 12:47
  • 2
    The Ubuntu part (APT/apt-get) starts at 01 min 48 secs. apt list -a code to get the list of possible versions for Visual Studio Code (and the specific format for the version number) and sudo apt install code=1.62.1-1636111026 to downgrade to version 1.62.1. Despite "install" it will downgrade (effectively uninstalling the current version first) - part of the confirmation message is "The following packages will be DOWNGRADED: code" Commented Nov 17, 2021 at 13:49
  • 1
    I can confirm using sudo apt install code=1.62.1-1636111026 to downgrade from version 1.62.2 to 1.62.1 of Visual Studio Code and (again) being able to Git push to GitHub from within Visual Studio Code actually works on Ubuntu MATE 20.04 (Focal Fossa). No other change was made. Commented Nov 17, 2021 at 21:29
7

If you are windows. And you changed the password of the git credential recently. You may see the error in the next git action or new clone.

  1. Go to Control Panel -> All Control Panel Items -> Credential Manager
  2. Go to Windows Credentials.
  3. Find the existing GIT URL git:https://xxxxx under Generic Credentials.
  4. Edit the credential, and enter new password. Then try your actions again.
3
  • 2
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Feb 23, 2022 at 10:13
  • 1
    That is the right answer for windows. Commented May 20, 2022 at 10:32
  • In step 4. be sure to put a personal access token and not your GitHub password.
    – Rod
    Commented May 8, 2023 at 0:53
4

This post here solved my issue.

I had temporarily been using git config --global credential.helper cache and pushing commits in the regular Linux shell using a personal access token.

After entering and caching in the regular Linux shell, I've so far been able to push commits per usual in Visual Studio Code's terminal.

UPDATE: Tried Git store with the command $ git config credential.helper store and Im now able to push to my repo no problem without having to input the PAT with every push. Cache only works temporarily. Also found a pretty in-depth post here that explains the process of storing github PATs for mac, windows and linux more in depth. However, it's an old post.

3
  • Was the temporarily thing before or after? E.g., did you create and use a new personal access token? Were you already using a personal access token? Commented Nov 17, 2021 at 20:56
  • 1
    That question has 37 answers. What did you use and do in particular? Can you elaborate? Please respond by editing (changing) your answer, not here in comments (without "Edit:", "Update:", or similar - the answer should appear as if it was written right now). Commented Nov 17, 2021 at 20:57
  • What did I write about "Edit"? Can you fix it, please? Thanks in advance. Commented Nov 18, 2021 at 6:47
3

I changed my machine's password and faced the same issue in VS Code (on Windows). I fixed it by updating password in Credential Manager of Control Panel.

enter image description here

Then click on the notch shown in rectangular highlight. It'll show a small window where you can edit the credentials. Once done, hit Save button.

Ola!

0

This problem happened android studio as well. here is my solution

I solved this problem in a very easy way. Firstly, after entering my username and password, it shows me a message like 'Support for password authentication was removed on August 13, 2021.'.

Then I just clicked the push button on Android Studio, authentification problem didn't appear.

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.