27

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?

Andrew T.
  • 4,701
  • 8
  • 43
  • 62
Adrian D.
  • 514
  • 1
  • 5
  • 12
  • 1
    I also got it on Linux ([Ubuntu MATE 20.04](https://en.wikipedia.org/wiki/Ubuntu_MATE#Releases) (Focal Fossa)). Is it restricted to Linux or not? – Peter Mortensen Nov 16 '21 at 23:01
  • As this may become the canonical question for this scandal, perhaps make the title more specific and more descriptive? But probably not *"Fix for the November 2021 Visual Studio Code update scandal (1.62.2)"* – Peter Mortensen Nov 17 '21 at 23:04
  • 1
    The full error message may or may not include *"remote: No anonymous write access."*. – Peter Mortensen Nov 18 '21 at 16:23
  • 1
    Or *"remote: Repository not found."* – Peter Mortensen Nov 19 '21 at 22:02
  • It may also [affect Windows](https://stackoverflow.com/questions/69977468/vscode-remote-repository-not-found-fatal-authentication-failed-for) (not said directly, but keywords are *"Windows Credentials"*, *"Git Credential Manager for Windows"*, *"rundll32.exe"*, and *"CMD"*). – Peter Mortensen Nov 19 '21 at 23:10
  • A 1.62.3 version is now available. [Release notes](https://code.visualstudio.com/updates/v1_62) (but it is difficult to tell if it fixed the problem or not due to the, as [Sabine Hossenfelder](https://www.youtube.com/c/SabineHossenfelder/videos) says, gobbledygook). – Peter Mortensen Nov 21 '21 at 20:48
  • There are [conflicting](https://stackoverflow.com/questions/69977468/vscode-remote-repository-not-found-fatal-authentication-failed-for#comment123845450_69977468) [reports](https://stackoverflow.com/questions/69948454/git-authentication-with-github-fails-remote-no-anonymous-write-access/69951853#69951853). – Peter Mortensen Nov 22 '21 at 02:01
  • 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 Dec 01 '21 at 15:30
  • 2
    This question is being discussed [on Meta](https://meta.stackoverflow.com/questions/413442/banned-from-review-queues-for-a-non-question-in-my-eyes). – Ian Campbell Dec 02 '21 at 18:17

8 Answers8

25

Pretty working solution ✅

I faced this problem.... 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

Happy Coding

Baimam Boukar
  • 908
  • 5
  • 20
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

Adrian D.
  • 514
  • 1
  • 5
  • 12
  • 1
    Where do you get older version of visual studio code? – Bogdan Nov 15 '21 at 23:14
  • @Bogdan You'll have to look up how to do it on your specific operating system. – Adrian D. Nov 16 '21 at 01: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](https://odysee.com/@DistroTube:2/how-to-downgrade-packages-in-debian-and:4)"*. – Peter Mortensen Nov 17 '21 at 12:47
  • 2
    The Ubuntu part ([APT](https://en.wikipedia.org/wiki/APT_(software))/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"* – Peter Mortensen Nov 17 '21 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](https://en.wikipedia.org/wiki/Ubuntu_MATE#Releases) (Focal Fossa). *No other change was made*. – Peter Mortensen Nov 17 '21 at 21:29
  • Downgrading may or may not [create other problems](https://stackoverflow.com/questions/70014751/git-pull-push-indefinitely-hanging). I haven't experienced any problems with the downgrade so far, though. But it is something to keep in mind. – Peter Mortensen Nov 18 '21 at 16:29
  • Since it took me a while to find the answer to @Bogdan's original comment question, here is a link that provides URLs for all the previous versions: https://code.visualstudio.com/docs/supporting/faq#_previous-release-versions. Downgrading to v1.62.1 fixed the problem for me as well. – Ray Osborn Nov 18 '21 at 18:42
8

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
mrgou
  • 1,576
  • 2
  • 21
  • 45
  • The workaround did not make any difference for me (I changed it in both *"Workspace"* and *"User"*) - precisely the same error message. – Peter Mortensen Nov 16 '21 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 Nov 17 '21 at 09:56
  • Here is [an extended version](https://stackoverflow.com/questions/69948454/git-authentication-with-github-fails-remote-no-anonymous-write-access/69999186#69999186). I haven't tried it (yet) - [I went with downgrading Visual Studio Code to 1.62.1](https://stackoverflow.com/questions/69979522/fix-for-fatal-authentication-failed-for/69985868#comment123761649_69979523) to get it working again, but I may dig deeper later using a separate non-critical non-production environment. – Peter Mortensen Nov 18 '21 at 00: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. Nov 22 '21 at 00: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 – Leigh Mathieson Nov 23 '21 at 04:36
8

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:password@github.com/organization/repo.git

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

KIRAN KUMAR B
  • 404
  • 4
  • 8
6

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.
Wilber82
  • 61
  • 1
  • 5
  • 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](/help/how-to-answer). – Community Feb 23 '22 at 10:13
  • 1
    That is the right answer for windows. – Nico Müller May 20 '22 at 10:32
  • In step 4. be sure to put a personal access token and not your GitHub password. – Rod May 08 '23 at 00: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.

  • 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? – Peter Mortensen Nov 17 '21 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](https://stackoverflow.com/posts/70008256/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written right now). – Peter Mortensen Nov 17 '21 at 20:57
  • What did I write about "Edit"? Can you fix it, please? Thanks in advance. – Peter Mortensen Nov 18 '21 at 06: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!

ShaileshDev
  • 1,086
  • 13
  • 16
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

dan1st
  • 12,568
  • 8
  • 34
  • 67