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
.
ERROR!
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
- Open Keychain Access
- Search for "github"
- If you have multiple entries, for me the
github.com
internet password
on thelogin keychain
(notiCloud keychain
) entry was the one. Double click on it - Click on the checkbox next to
Show password:
- Enter your Mac User password.
- Replace the password of your git account that you see there with your Personal Access Token.
- 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!
Jelle