Updating Github CLI with a personal access token on MacOSX

A short guide on how to get a personal access token from Github, how to add it to your terminal so you can keep git pushing all that code you wrote πŸ‘¨β€πŸ’»

Updating Github CLI with a personal access token on MacOSX

Alright, let's keep it short. I normally use BitBucket, but had to make a few changes to a Github git repo.

So I did the changes, added everything, wrote a poem of a Β commit message, wrote git push in the terminal and then pressed enter.


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.

And while the blogpost is a helpful guide on helping you generate an access token, it doesn't tell you what to do with it.

How to use your Github Personal Access Token on Mac OSX

  1. Open Keychain Access
  2. Search for "github"
  3. If you have multiple entries, for me the github.com internet password on the login keychain (not iCloud keychain) entry was the one. Double click on it
  4. Click on the checkbox next to Show password:
  5. Enter your Mac User password.
  6. Replace the password of your git account that you see there with your Personal Access Token.
  7. You can now push all those magnificent code changes again in the terminal.

Why is this necessary?

Before Github worked with personal access tokens, you entered your password. And so you entered your Github password in every application that worked with Github: the Github CLI, maybe a git plugin for Pycharm/Webstorm/VS Code, the Github GUI, etc. And as every application has basically full control over your Github account, it can delete repos, read pgp keys, etc. That's not very secure.

By using personal access tokens you can create an access token for every application that requires you to be authenticated. So this way you can create a PAT (Personal Access Token) for the Github CLI, another one for Pycharm, etc. You can also set the scopes for every PAT. That way you can give only the applications you fully trust pgp key read access for example.

I hope this little guide helped you!