I started experiencing this issue on Visual Studio Code in Ubuntu 20.04 yesterday.
I did not make any changes to my GitHub credentials, neither did I change anything in the project, but I run any git command to communicate with my remote branch like:
git pull origin dev
I get the error below:
remote: Repository not found.
fatal: Authentication failed for ‘https://github.com/MyUsername/my-project.git/’
Here’s what worked for me:
I tried recloning the project and then running the git pull command but it did not work.
git clone https://my-git-url
I tried setting my credentials again using the below commands but still no luck:
git config --global user.email "email@example.com"
git config --global user.name "John King"
I tried removing the remote repository and re-adding it using the below commands, but still no luck:
git remote remove origin
git remote add origin https://my-git-url
Finally, I decided to try using my default Ubuntu terminal and it worked fine. My big guess is that it’s a bug from Visual Studio Code from the last update that was made some few hours before then (See the screenshot that shows that a Release was done on the same day that I was having the issue). I mean I set up Visual Studio Code using snap, so probably it might have been updated in the background a few hours before then.

Hopefully, they will get it fixed and git remote operations will be fine again.
Git is a popular version control software that every developer should know how to use. But sometimes, it pops out strange errors that confuses even seasoned users. If you are seeing “Authentication failed” whenever you try to use git push command, this short article is going to help you solve this error message.
The “fatal: Authentication failed” error message indicates that the existing authentication method you have been using on your repository has become obsolete/outdated. The full error message may look like this
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/user/example-project.git/'Code language: JavaScript (javascript)
Or if you’re pushing to your remote repository via HTTPS, the error message may look like this
If you enabled two-factor authentication in your Github account you won't be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your Github account. Using this token as your password should allow you to push to your remote repository via HTTPS. Use your username as usual.
Usually, the “Authentication Failed” error happens if you recently enabled 2-Factor Authentication on your GitHub account and uses HTTPS to push/pull in Git at the same time. GitHub deprecates the password authentication method from August 13, 2021 to favor more secure way of authentication. In this article, we will show you several possible ways to get around the “fatal: Authentication failed” problem.
Switch to SSH protocol in Git
As being said earlier, Github is no longer allow authenticating via HTTPS URLs once 2-Factor Authentication (2FA) enabled. Git with HTTPS uses public-key encryption-based authentication for doing every action like git push, git clone, git fetch and git pull, etc. Meanwhile, SSH protocol allows Git to securely transfer repository data over the internet.
In order to quickly fix “fatal: Authentication failed”, you can remove the existing origin (which is something like https://github.com:user/repo.git) and re-add a [email protected]:user/repo.git URL to instruct Git to use SSH instead. Run the following command to do so:
git remote -v
git remote remove origin
git remote add origin [email protected]:user/repo.git
If you didn’t set up the necessary private keys for Git, running the commands above will end up with an error message. You may need to consult access Github repositories using SSH keys and Connecting to GitHub with SSH for instructions on adding private keys.

Create a PAT (Personal Access Token)
When you connect to a GitHub repository from Git, you’ll need to authenticate with GitHub using either HTTPS or SSH. Alternatively, you can use Github CLI with the command gh auth login. All of these authentication method requires a PAT (Personal Access Token) that is a more secure alternative to passwords. Follow the instructions below to create a PAT :
First, login to your account. In the upper right corner of the page, look for your avatar, click it and select Settings.
In the Settings page, choose Developer settings > Developer settings > Personal access tokens in the left sidebar.

Click Generate new token in order to create a new PAT. You will be able to name the token, set its expiration date and its scope. For a token that specifically for managing repositories, you should limit the scope to repo.

Finally, click Generate token. You would be redirected to another page which shows you the newly created token. Remember that the token will only be shown once. If you lost the token, you have no way to recover it but to re-generate a new one.
Treat your tokens like passwords and keep them in a secure place. The token should be stored in an environment variable instead of hardcoding them into your programs/applications source code.
Once you’re done creating a token, you have to reset the old password authentication by running the following command.
git config --global --unset credential.helperCode language: PHP (php)
You may also need to update your repository to change the protocol from HTTPS to native SSH
git remote -v
git remote remove origin
git remote add origin [email protected]:user/repo.git
Disable Github 2-Factor Authentication
If you recently enabled 2-Factor Authentication(2FA) on your GitHub account right before the “Authentication Failed” error pops up, you can try disabling it to quickly fix the problem.
However, remember that disabling 2FA significantly increase the risk of your account to be compromised. Also, If you’re a member, billing manager, or outside collaborator to a public repository of an organization that requires two-factor authentication and you disable 2FA, you’ll be automatically removed from the organization, and you’ll lose your access to their repositories. In order to regain access to the organization, you have to re-enable 2FA and re-apply to the organization.
To disable 2FA for an account, you need to log into it, then click your profile photo in the upper right corner and select Settings.

Then, select Account Security in the left sidebar and click Disable in Two-factor authentication section.

Remove saved credentials on Windows
Windows users may beed to change your login or password of the Git service account stored in Windows Credential Manager.
First, you need to search for Windows Credential Manager from the Start menu. Usually it is placed in Control Panel if you use Windows 7 and Settings on newer Windows versions.
On the Credential Manager window, click on Windows Credentials tab and look for anything that starts with git: or ada:. In order to remove them, you would have to click each of them to open the details view and click Remove.
You may also need to remove them from Generic Credentials, too.

We hope that the information above helps you solve the “fatal: Authentication failed” error message in Git. You may want to check out our other guide on fixing other popular Git issues such as Git : how to accept all current/incoming changes, How to clone a private repository in Github or How to access GitHub from inside China.
After updating domain password, accessing git-repo is no longer possible. VS Code and Source Tree as well as Visual Studio are returning the following error message on pull, push, fetch etc..
fatal: Authentication failed
Normally a credentials pop-up should appear however this is not happening. Also the common recommendation is not working:
git config --global credential.helper wincred
![]()
isherwood
57.8k16 gold badges113 silver badges154 bronze badges
asked Mar 16, 2017 at 9:42
Jesper WilfingJesper Wilfing
11k5 gold badges29 silver badges32 bronze badges
2
The password is stored in windows credential manager and needs to be updated. Open command prompt and enter the following command to view the list of stored passwords:
rundll32.exe keymgr.dll,KRShowKeyMgr
Scroll down in the list until you spot the git-related entries. Click it and edit the correct password.
Voilà!

answered Mar 16, 2017 at 9:42
Jesper WilfingJesper Wilfing
11k5 gold badges29 silver badges32 bronze badges
9
I agree with Jesper, Other way to do is — On windows, if you can navigate to :
Control PanelUser AccountsCredential Manager
Under Windows CredentialsWindows Vault page on Generic Credentials, you can update the password of existing GIT record or can also add new Generic Credentials.
Updated answer for Mac users :
In case if you’re here with similar issue on Mac, you can do similar thing in keychain access — by deleting the existing GIT record, & then if you pass your credentials again in git bash or any other tool a new record gets created, things should work.
answered Oct 1, 2018 at 16:34
![]()
1
Try the following:
- Click Start
- Type: Credential Manager
- See the Windows Credential Manager shortcut and double-click it to open the application.
- Once the app is open, click on the «Windows Credentials» tab.
- Locate the credentials that you want removed, they will start with «git:» and might begin with «ada:»
- Click on the credential entry, it will open a detail view of the entry.
- Click Remove and confirm removal when prompted.
answered Jul 18, 2019 at 7:23
![]()
I have experience a similar issue with Windows 10 and here’s how I have solved it:
- From Windows Search, type Credential Manager:

-
Open Credential Manager, and navigate to Windows Credential Tab:

-
You should see an entry for git credentials in Windows Credential Manager:

Here is the root cause, this git credentials is locally cached/saved to your local computer, and since we have changed our Active Directory password, it is currently out of synch.
- Click Edit, and change this to your new/changed Active Directory password (this password has to match your new/changed Active Directory password) :

Note: This is for using git with https only, not for SSH: https://docs.github.com/en/free-pro-team@latest/github/using-git/which-remote-url-should-i-use
- Save, it should work (does not require terminal or machine restart).
Lastly, if you do not have access to Credentials Manager (due to admin/security policy), you can force git to prompt for password by do a git pull from the specific repo by using username based repo url, e.g.
git pull https://{yourgitusername}@{gitrepo}.git

Note that, this is repo specific so you will have to do this each repo.
Good luck.
answered Oct 5, 2020 at 13:12
![]()
MaksoodMaksood
1,18014 silver badges19 bronze badges
0
I faced the same issue and none of the above mentioned solutions did work. Finally I just removed git for windows and reinstalled the same without any credential managers. This solved the authentication issue with git.
answered Sep 10, 2020 at 16:56
![]()
SiteshSitesh
1,7561 gold badge17 silver badges24 bronze badges
0
Using Git for Windows (2.30.0), with the cross platform credential manager, with the remote set as a https GitHub address, to a public repository, doing git push by itself wasn’t sufficient.
Instead I had to explicitly do git push origin main (replace main with master, or whatever your branch is) to have Git for Windows load a GitHub authentication page where I could authorize the application.
Creating a personal access token, as noted in another answer, was not necessary. Windows credentials were not present in Windows Credential Manager, but were added as Generic Windows Credentials via this method.
answered Jan 2, 2021 at 5:46
James SkempJames Skemp
7,9489 gold badges64 silver badges106 bronze badges
2
Try to manually remove setting
credential.helper=wincred from
C:Users<YOUR LOGIN>.gitconfig file it it’s there.
For me it helped after password change in LDAP.
Command to change setting didn’t helped.
answered Jun 11, 2021 at 11:59
Maxim KorobovMaxim Korobov
2,5741 gold badge26 silver badges44 bronze badges
Honestly, what worked for me was installing the latest version of Git (2.36.1) to the day of this comment.
Happened the same: it stoped working after I changed the AD password. But it seems to be a bug in older releases.
This was a tip that Azure DevOps gave:

answered May 17, 2022 at 15:09
![]()
BazilBazil
4294 silver badges6 bronze badges
The only thing which worked for me was to remove the remote and add it back. I have tried deleting the credentials and even reinstalling the git the latest version. But the suggested way to access the remotes repos from Github and Microsoft DevOps is by using a shared key.
answered Sep 27, 2020 at 10:32
I was having the same problem and the best solution would be to insert whenever putting » git clone https://@praat.scm.azurewebsites.net:443/.git » [Insert after http:// your username and @ ] and the cloning will work.
answered Aug 19, 2021 at 20:56
You cannot use your password for git push or other Git operations (but you still need it to log in). You need to create a personal access token and enter that instead when Git asks for your password. When creating the token make sure to select the repo scope (for repository access, like pushing) and if you use Actions also workflow (required to modify workflow files).
4 replies
What happens if the personal access token is not working as a verification method? It’s set to public, but when I correctly enter my username and personal access token, I still get ‘remote: Invalid username or password. fatal: Authentication failed for ».
It has to work, can you send a screenshot ?
THANK YOU SOOOOOOO MUCH!!!!
![]()
После включения двухфакторной аутентификации в моей учётной записи GitHub, когда Я запускаю команду Git git push она выдаёт следующее сообщение об ошибке:
$ git push Username for 'https://github.com': Username Password for 'https://Username@github.com': remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/username/repository.git/'
Что вызывает эту ошибку
Это сообщение об ошибке говорит само за себя. Это означает то, что мы пытаемся использовать неверное имя пользователя или пароль. Но Я уверен в том, что использую правильное имя пользователя и пароль. В моём случае, это произошло со мной после того, как Я включил двухфакторную аутентификацию (2FA) в моём аккаунте GitHub. Поэтому я знаю о том, что вызвало это сообщение об ошибке.
Как это решить
Как только мы узнали о том, что вызывает сбой работы git, мы можем использовать это для решения проблемы. Это действительно простой процесс. Для того, чтобы решить эту проблему, нам нужно всего лишь создать личный token доступа GitHub и использовать его вместо нашего пароля GitHub и двухфакторного кода аутентификации. Теперь пошаговое руководство.
Создание token доступа к персональному доступу GitHub.
В правом верхнем углу любой страницы нажмите на фотографию своего профиля, затем нажмите Settings.
В левой боковой панели нажмите Developer settings.
В левой боковой панели нажмите Personal access tokens.
Нажмите Generate new token.
Дайте вашему token имя (любое имя описывающее цель его создания).
Выберите области действия или разрешения, которые вы хотите предоставить этому token. Для того, чтобы использовать ваш token для доступа к репозиториям из командной строки, выберите repo.
Нажмите Generate token.
Скопируйте token в буфер обмена. По соображениям безопасности, после ухода со страницы, вы не сможете снова увидеть token.

Примечание! Относитесь к своим token’ам, как к паролям и держите их в тайне (если вы не хотите, чтобы другие люди использовали API от вашего имени). При работе с API, используйте token’ы как переменные окружения вместо hardcoding их в ваши программы.
Использование token в командной строке.
Как только у нас появился token, мы можем ввести его вместо нашего пароля при выполнении операций Git через HTTPS. Просто введите свой token после запроса пароля, а затем смотрите на то, как происходит магия…
Username: your_username Password: your_token
Примечание! Token’ы личного доступа могут использоваться только для операций HTTPS Git. Если ваш репозиторий использует удалённый URL SSH, вам нужно будет переключить управление с SSH на HTTPS.
Примечание! Если вам не будет предложено ввести имя пользователя и пароль, ваши учетные данные могут быть кэшированы на вашем компьютере. Вы можете обновить свои учетные данные в Keychain заменить старый пароль на token.
Заключение
Вот и всё, готово. Теперь проблема возникшая после включения двухфакторной аутентификации в учётной записи GitHub устранена. Так просто, не так ли?
Если у вас возникают проблемы в устранении этой проблемы с помощью приведенной выше инструкции, но вы смогли решить эту проблему любым другим способом, пожалуйста, опишите его в разделе комментариев ниже. Спасибо!
Я надеюсь, что эта статья помогла вам узнать, как решить проблему которая возникла после включения двухфакторной аутентификации в учётной записи GitHub. Если эта статья помогла вам решить проблему, пожалуйста, оставьте комментарий ![]()
Спасибо за прочтение!
