+1 vote
in General IT Tips by (71.8k points)

When I run the git command 'git push origin main' on the terminal with my user and password, it gives the following error message: 

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

 How to fix it so that I can run git commands?

1 Answer

+2 votes
by (8.9k points)
selected by
 
Best answer

GitHub now does not allow password to access Git; you need to use personal access token instead of a password to access GitHub.

Here are the steps to generate a personal access token:

  • Log in to GitHub using your username and password.
  • From your profile, go to "Settings".
  • On the "Settings" page, click on the "Developer Settings" link.
  • On the "Developer Settings" page, click on "Personal access tokens," select "Fine-grained tokens," and click on the "Generate new token" button.
  • Fill up the details asked on the page, such as Token name, Expiration, Description, Repository access, and Permissions. Some of these fields are optional.
  • Click on the "Generate token" button to generate a token.
  • Keep the token safe, as you need it to log in to GitHub.
  • Now log in to GitHub using the user ID and token as password.

...