Git push -u origin username password

I have a problem with git push -u origin when I enter my github username and password it gives this error: git push -u origin master

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: Authentication failed for 'https://github.com/Ahmadmohseni/Concert_ticketsales_system_project.git/'

You need to create a Personal Access Token, the following is taken from the official documentation linked here.

  • Go to Profile > Settings > Developer Settings > Personal Access Tokens
  • Click Generate New Token
  • Give it a name
  • Give it an expiration date
  • Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select repo
  • Click Generate Token and copy it, keep it safe if you lose it you will need to generate a new one
  • When using git push, git pull or other commands which require authentication you can use it instead of your password

You can cache your token with a credential manager to avoid inputting it each time, the following link provides info relating to that:

Caching your credentials in git

Back to Top