0% found this document useful (0 votes)
48 views

Fix Password Authentication GitHub

1) GitHub removed support for password authentication and now requires the use of personal access tokens for Git operations that require authentication. 2) The article provides a step-by-step guide to create a personal access token on GitHub and configure it for use. This involves generating a token, changing the remote URL, and testing it works by pushing a commit. 3) Access tokens allow users to authenticate Git operations on GitHub after password authentication was removed for security reasons.

Uploaded by

Solo Para Ti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Fix Password Authentication GitHub

1) GitHub removed support for password authentication and now requires the use of personal access tokens for Git operations that require authentication. 2) The article provides a step-by-step guide to create a personal access token on GitHub and configure it for use. This involves generating a token, changing the remote URL, and testing it works by pushing a commit. 3) Access tokens allow users to authenticate Git operations on GitHub after password authentication was removed for security reasons.

Uploaded by

Solo Para Ti
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

7/3/23, 22:16 How to Fix Support for password authentication was removed on GitHub | Level Up Coding

Published in Level Up Coding


Open in app Sign up Sign In

You have 2 free member-only stories left this month.


Sign up for Medium and get an extra one

Giorgos Myrianthous Follow

Dec 19, 2021 · 4 min read · · Listen

Save

How to fix support for password authentication


was removed on GitHub
Understanding how to configure and use Access Tokens in GitHub

Photo by Twitter @ethmessages on Unsplash

https://levelup.gitconnected.com/fix-password-authentication-github-3395e579ce74 1/7
7/3/23, 22:16 How to Fix Support for password authentication was removed on GitHub | Level Up Coding

Introduction
In July 2020, GitHub announced their intent to require users to use token-based
authentication in order to perform certain (authenticated) Git operations. Going
180 10
forward and as of the 13th of August 2021, account passwords are no longer
accepted when authenticating with the REST API.

For instance, if you attempt to push on the remote server using password
authentication the operation will fail with the following message:

Support for password authentication was removed on August 13, 2021.


Please use a personal access token instead

The recent changes affect the command line access to Git as well as any services
accessing GitHub repositories directly with the use of password. On the other hand,
if you have already enabled the two-factor authentication you are required to use a
token-based authentication (or SSH-based authentication) and therefore you
shouldn’t be seeing the error mentioned above.

In today’s article we will discuss we will go through a quick step by step guide that
will help you configure Access Tokens on GitHub that we’ll allow you to perform
token-based authentication when executing Git operations that require you doing
so.

Reproducing the error


Now let’s assume that you’ve initialised a Git repository ( git init ), you’ve done
some work and created a commit and finally you want to push the changes made to
the remote host.

$ git push -U origin main


Username for 'https://github.com': <username>
Password for 'https://[email protected]':
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.
https://levelup.gitconnected.com/fix-password-authentication-github-3395e579ce74 2/7
7/3/23, 22:16 How to Fix Support for password authentication was removed on GitHub | Level Up Coding

fatal: Authentication failed for


'https://github.com/<username>/repo-name.git/'

Given that you are attempting to perform password-based authentication, the push
command will fail with the authentication fatal error shown above.

Fixing the error: A step by step guide


In the following sections we will go through a step by step guide that will help you
configure Access Tokens on GitHub so that you can perform token-based
authentication when performing Git operations requiring authentication.

Step 1: Create Access Token on GitHub


First of all, you must create a personal Access Token on GitHub. To do so follow the
steps below:

Click on your GitHub profile icon on the top right corner

Click Settings

From the menu shown on the left, click Developer Settings

Click Personal access tokens

Click Generate new token

Add a note that will help you identify the scope of the access token to be
generated

Choose the Expiration period from the drop down menu (Ideally you should
avoid choosing the No Expiration option)

Finally, select the scopes you want to grant the corresponding access to the
generated access token. Make sure to select the minimum required scopes
otherwise you will still have troubles performing certain Git Operations.

Finally click Generate Token

https://levelup.gitconnected.com/fix-password-authentication-github-3395e579ce74 3/7
7/3/23, 22:16 How to Fix Support for password authentication was removed on GitHub | Level Up Coding

By now, you should have generated your personal access token successfully and the
following message should be visible on your screen.

Source: Author

Underneath that message, you should also be able to see your personal access
token. Make sure to copy it as we will need it in the following step(s).

Step 2: Change the remote URL


Now that we have created our personal access token, we need to run the following
command:

git remote set-url origin


https://<githubtoken>@github.com/<username>/<repositoryname>.git

In the above command make sure to replace:

<githubtoken> with the personal access token you have copied in the previous
step

<username> with your GitHub username

<repositoryname> with the name of your GitHub repository

Step 3: Test that it works


Now we have successfully configured token-based authentication for a specific
repository on GitHub. To test that everything went to plan, simply try to push the
changes you’ve made locally to the remote host. For example,

$ git push -u origin main

and the Git operation should be executed with no issues.

https://levelup.gitconnected.com/fix-password-authentication-github-3395e579ce74 4/7
7/3/23, 22:16 How to Fix Support for password authentication was removed on GitHub | Level Up Coding

Final Thoughts
In today’s short guide we discussed about the recent changes made on GitHub that
now require users to perform token-based authentication as password-based
authentication are no longer accepted.

Additionally, we went through a step-by-step guide that will help you configure your
GitHub Access Tokens that will allow you to properly authenticate Git operations.

Become a member and read every story on Medium. Your membership fee directly
supports me and other writers you read. You’ll also get full access to every story on
Medium.

Join Medium with my referral link — Giorgos Myrianthous


As a Medium member, a portion of your membership fee goes to
writers you read, and you get full access to every story…
gmyrianthous.medium.com

You may also like

How To Undo The Last Local Commit in Git


Understanding how to undo the most recent local commit in Git
towardsdatascience.com

https://levelup.gitconnected.com/fix-password-authentication-github-3395e579ce74 5/7
7/3/23, 22:16 How to Fix Support for password authentication was removed on GitHub | Level Up Coding

How To Merge Other Git Branches Into Your Own


Quickly merge branches using the command line or GitHub Desktop
betterprogramming.pub

Level Up Coding
Thanks for being a part of our community! Level Up is transforming tech recruiting.
Find your perfect job at the best companies.

Level Up — Transforming the Hiring Process


🔥 Enabling software engineers to find the perfect role that they love
🧠 Finding talent is the most painful part of…
jobs.levelup.dev

Git Github Programming Software Development Security

Sign up for Top Stories


By Level Up Coding

A monthly summary of the best stories shared in Level Up Coding Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review
our Privacy Policy for more information about our privacy practices.

Get this newsletter

https://levelup.gitconnected.com/fix-password-authentication-github-3395e579ce74 6/7
7/3/23, 22:16 How to Fix Support for password authentication was removed on GitHub | Level Up Coding

About Help Terms Privacy

Get the Medium app

https://levelup.gitconnected.com/fix-password-authentication-github-3395e579ce74 7/7

You might also like