This is so stupid, and if you just googled “Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.” I know you agree! Github literally just quit working 3 minutes ago because of their idiotic decision to drop support for passwords.
Okay so what now? I actually don’t know, but… I’m going to figure out how to add a personal access token and drop the instructions here in this blog post:
Step 1: Click Profile > Settings on Github.com
Step 2: Click the Developer Settings Option
Step 3: Click Personal Access Tokens
Step 4: Click Generate New Token
Step 5: Add Note, Set an Expiration Date, Select Scopes, Click Generate Token
Step 7: Copy and paste your new access token to a safe place like a password manager!
For this step I’m not including a picture just to make sure I don’t accidentally expose my access token. But it should be pretty obvious. Simply copy the access token, then paste it into your password manager (Dashlane, 1Password, or whatever other password manager you use). If you don’t have a password manager, I suggest now is a good time to get one. Also, if you’re wondering: what the hell is a personal access token? It’s just a fancy password, so that’s why I advise you keep in your new password manager.
Step 8: Run crazy terminal commands to install Microsoft’s Git Credential Helper
I know, I thought there would be a better option than this. However, it makes sense that since Microsoft owns Github now, they’ve essentially manufactured a new problem that must be solved by using one of their products. So yeah, that’s the next step– open the terminal app on your Mac and run these commands to install Microsoft’s Git Credential Helper:
$ brew tap microsoft/git
$ brew install --cask git-credential-manager-core
UPDATE (February 26th, 2022): I’ve noticed recently that I personally can’t install the credential manager on my M1 MacBook Pro anymore using brew. I run into an error which looks something like:
Error: Failure while executing; `/usr/bin/sudo -E — /usr/bin/env LOGNAME=christopherpedersen USER=christopherpedersen USERNAME=christopherpedersen /usr/sbin/installer -pkg /opt/homebrew/Caskroom/git-credential-manager-core/2.0.632.34631/gcmcore-osx-2.0.632.34631.pkg -target / -allowUntrusted` exited with 1. Here’s the output:
installer: Package name is Git Credential Manager
installer: Installing at base path /
installer: The install failed. (The Installer encountered an error that caused the installation to fail. Contact the software manufacturer for assistance. An error occurred while running scripts from the package “gcmcore-osx-2.0.632.34631.pkg”.)
If you run into this issue, instead of using brew download the macOS pkg from Github. However, don’t download the latest version as I believe there’s a bug in the latest version. I would recommend downloading: gcmcore-osx-2.0.498.54650.pkg
After you download the pkg file, go to Finder > Downloads and then right-click on the pkg file and select “Open with Installer” and finish the installation.
Next, you’ll need to open up a new terminal window and enter:
$ git-credential-manager-core configure
A window should pop up at some point after running that command where you’ll be able to paste your new Personal Access Token which is the last step in setting up the Git Credential Manager.
Step 9: Last, run $ git push and paste your Personal Access Token into the Microsoft Git Credential Popup Window
This last step is actually pretty simply: You just run $ git push like you normally would from your project directory, but now a popup window from the Microsoft Git Credential Helper will appear where you can paste your new Personal Access Token. And that’s it, you’re back in business my friend 🙂
Bonus Step: Adding Your New Github Personal Access Token to Your Ubuntu Linux Server
Okay so this last step I came back and added one day later after writing the above steps for Mac. The steps above don’t really work server-side. Supposedly Microsoft’s Credential Manager supports Linux but I couldn’t get it to work for me. So here are my five magic terminal commands to add your new personal access token to your Ubuntu Linux Server:
$ ssh email@example.com
$ cd ~/yourproject
$ git config --global credential.helper 'cache --timeout=32850000'
$ git remote rm origin
$ git remote add origin https://yourGithubUsername:yOUrPeRsONALacceSsTOKeN@github.com/yourGithubUsername/yourproject.git