If you’re like me and a bit slack with your personal projects you might’ve started receiving the following error today:
admin@Admins-iMac ui % git push 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: unable to access 'https://github.com/Buzzology/referrer.git/': The requested URL returned error: 403
As the message says, Github wants you to start using a Personal Access Token (PAT) instead of password authentication. Luckily, the fix is pretty straight forward – you’ll need to create a Personal Access Token and then update your keychain.
Step #1: Create a Personal Access Token (PAT)
To create the personal access token, login to Github and go to the following page: https://github.com/settings/tokens
You can also get to this page via the following:
- Click on your profile dropdown
- Click settings
- Click Develop Settings (on the left)
- Click Personal access tokens (on the left)
Once you’re on the Personal Access Tokens page you should see something like the following:
Click the Generate new token button, set an expiry and then copy the generated value (you’ll need it in the next step).
Step #2: Updating your keychain
Now that you’ve got your Personal Access Token you need to replace the password that you’ve currently got stored in your keychain. To start, open search and bring up Keychain Access:
If you’ve got quite a few keys there you can filter them by searching for github. You’ll then need to double click on each of the entries and replace the stored password with your personal access token:
Note that you’ll first need to click Show Password.
Now that your keychain is updated, close and then re-open any of your terminals and you should be good to go.
admin@Admins-iMac ui % git push Enumerating objects: 110, done. Counting objects: 100% (110/110), done. Delta compression using up to 4 threads Compressing objects: 100% (91/91), done. Writing objects: 100% (93/93), 15.30 KiB | 2.19 MiB/s, done. Total 93 (delta 64), reused 0 (delta 0), pack-reused 0 remote: Resolving deltas: 100% (64/64), completed with 14 local objects. To https://github.com/Buzzology/referrer.git 0d2ecf0..97f2716 master -> master admin@Admins-iMac ui %
Thanks to the following Stackoverflow post for the additional info: https://stackoverflow.com/a/67650257/522859