How to Solve Github’s Password Authentication Removed Error in AWS EC2
Your remote private git projects are probably broken with the update!
Just another day at work, and I was trying to pull the changes made to the Code repository hosted in Github manually. It was just shutting down the application, running the git pull command, and restarting the application. Something even a high schooler was able to do, but it all changed after the 13th of August!!
Now, I was faced with this error that was never seen prior to that fateful day
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 “…” : The requested URL returned error: 403
Why did this happen?
Let me first let you know, this is no fault of your own.
Github has been saying it will get rid of the username, password mechanism for quite a while….we just didn’t pay attention to it.
The reason Github gave was that it’s common for people to accidentally leak their passwords, and while a personal access token can be restricted to limit the damage, a password cannot.
So, to reduce possible security issues, they removed the password mechanism outright.
How to Solve it?
It is quite a simple issue to fix, just follow along.
Go to Github’s website and Navigate to Settings in the profile menu.
Scroll down to find the developer settings on the Settings page.
Then click on “Personal access tokens” and then “Generate new token”. Dont worry about the AWS EC2 token in mine, yours should be empty.
Give it a name and mark the repo checklist as true. This is important because it allows the users with this token to access your private repo’s.
Now, hit the generate token and you should be shown something like this (don’t worry I revoked this token after I finished writing this article).
Don’t forget to save this token, because once you go off the page you won’t see it again, and will have to regenerate another token from the start.
Pat yourself in the back, because you have reached the final step!!
There are two ways to do it,
The first way is to go into your EC2 repository and try pulling the code.
When you are asked the username and password, add your username in the username but for the password paste your token.
The second way is to change the remote URL of your AWS EC2 project local repository with
git remote set-url origin https://<token>@github.com/<username>/<repo>
Both of these methods work and everything should be back to normal.
Happy coding :)
Want more from me?
- Subscribe to get notified when I publish articles.
- Support my writing with no extra cost to you by becoming a referred Medium member.
- Connect and reach me on Linkedin and Twitter