How to fix the GitHub Support for password authentication error
Learn, how to fix the GitHub Support for password authentication was removed on August 13, 2021. Please use a personal access token instead error in macOS or Linux.
Today, I’m trying to push my code to GitHub remote repository I got the following error in my terminal.
➜ react-fileupload git: git push 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: unable to access 'https://github.com/saigowthamr/react-fileupload.git/': The requested URL returned error: 403
This error tells that for security reasons GitHub removes the password-based authentication from August 13, 2021.
To fix the error, follow the below steps:
Open GitHub.com, click on your profile picture, then click on settings.
Now, scroll to the bottom of a page and click on the Developer settings tab.
Now, click on Personal access tokens and generate a new token by giving the name and expiration date, etc.
Once you successfully generated the Personal access token copy it.
Now, open the Git repository where you got the error and remove the current origin by running the following command.
git remote remove origin
- Add the new origin by using the following command in your terminal.
git remote add origin https://<PERSONALACCESSTOKEN>@github.com/<USERNAME>/<REPO>.git
git remote add origin https://firstname.lastname@example.org/saigowthamr/car-demo.git
That’s it, now you can push your code to GitHub using the
git push command without any errors.