Kanlanc
Published in

Kanlanc

How to Solve Github’s Password Authentication Removed Error in AWS EC2

Your remote private git projects are probably broken with the update!

Photo by Markus Winkler on Unsplash

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

Image by Author

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.

Image by Author

Scroll down to find the developer settings on the Settings page.

Image by Author

Then click on “Personal access tokens” and then “Generate new token”. Dont worry about the AWS EC2 token in mine, yours should be empty.

Image by Author

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.

Image by Author

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.

Image by Author

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?

  1. Subscribe to get notified when I publish articles.
  2. Support my writing with no extra cost to you by becoming a referred Medium member.
  3. Connect and reach me on Linkedin and Twitter

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store