To promote security, starting from Aug. 2021, many GitHub operations require use of personal access tokens (PAT).
Generate personal access token#
Go to https://github.com/settings/tokens and click Generate new token
. Follow the guidelines.
Usually the token will expire after the specified time, unless you make it a permanent token,
which is not advised by GitHub.
After this, when you push to GitHub repos, you must use the generated token as password.
Update tokens#
After an old token expires, we need to generate a new token. Then we need to remove the old token and use the new token. The process may vary depending on your system.
macOS#
command line#
We need to erase the old token, run the following command:
security delete-internet-password -l github.com
Then run your git operation as usual and you will be prompted to enter your new token. Once your new token is entered and verified, it will be updated to the Keychain app automatically.
Keychain app#
You may also directly update the token via the Keychain Access
app.
Open the app and search for github.
Then open the searched item for github and directly update your access token there.