“Support for password authentication was removed on August 13, 2021.” – Github
You have many options to authenticate with GitHub
- PAM (expiring Personal Access Token) instead of a password
- SSH Authentication (link)
- Github CLI Authentication (link)
Why use SSH Authentication? (docs.github)
- No need to input Personal Access Token for every action
- Allows easy routing for multiple Github accounts on a single computer / workstation.
How to setup SSH Authentication?
- Step: Check for existing keys (optionally use those) (docs.github)
- Step: Create a key pair, add to ssh-agent, update config (docs.github)
- Step: Add SSH key to Github (docs.github)
Bash
# Check for existing keys
$ ls -al ~/.ssh
# Create a key
$ ssh-keygen -t ed25519 -C "your_email@example.com"
# Start ssh-agent
$ eval "$(ssh-agent -s)"
# Try checking for config for newer Macs
$ open ~/.ssh/config
> The file /Users/YOU/.ssh/config does not exist.
$ touch ~/.ssh/config
# Add this text
$ vim ~/.ssh/config
Host github.com
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
# Add private key to ssh-agent
$ ssh-add --apple-use-keychain ~/.ssh/id_ed25519
# Add SSH public key to clipboard
$ pbcopy < ~/.ssh/id_ed25519.pub
# Copy into github.com
# Find Profile > Settings > SSH and GPG keys > New SSH key
# Now you can clone with the SSH link
$ git clone git@github.com:your_username/your_repo.git
Note: The HTTPS and SSH addresses are different