GitHub how to use personal access Token

Published: Updated:

Starting form 13 August 2021, GitHub no longer support account passwords when authenticating Git operations, like:

git push origin branch_name
git pull origin branch_name

As a developer, to authenticate you need too use a personal acces token.
To generate one, go in Settings:
at the top right corner, on the left side of your Setting Profile
click on Developer settings
and on the next page click Personal access tokens,
than click “Generate new token” like is explain in GitHub docs
In the same document is saying to use your token as the password, which is very inconvenient.

A better approach is to use:

git remote remove origin
git remote add origin https://[TOKEN]@github.com/[USER]/[REPO].git
git push

In this way, you don’t have to enter every time your personal token.