This post is going to be a very short guide on creating/adding a PAT (personal access token) or SSH key on GitHub and adding it to a Linux (or Mac) host.
This is necessary because GitHub has deprecated password authentication as of August 13, 2021
This means all authentication on the platform can only be done two ways:
- SSH/GPG Keys
- PAT (Personal Access Tokens)
Generating SSH Keys
Follow this guide
to create ssh keys with
After that, you should have a public ssh key somewhere in your
In GitHub settings go under “SSH and GPG keys” -> “SSH Keys” -> “New SSH key”.
Now you can take that public key you just generated (
id_rsa.pub by default)
and copy paste the contents into key section on GitHub - don’t forget to give
it a descriptive title, hit “Add SSH key” and that’s it!
From here, you just have to remember to use SSH instead of HTTPS when cloning, pulling or pushing repos.
# do this
git clone email@example.com:lemonase/dotfiles.git
# instead of this
git clone https://github.com/lemonase/dotfiles.git
If you do want to continue to use HTTPS, you will need to generate a PAT on GitHub.
Generating a GitHub PAT (Personal Access Token)
Visit this link to get a guide on creating a PAT from your GitHub account.
Direct Link: https://github.com/settings/tokens
After the token is created with all the permissions desired (you probably want read/write acces to repos), go ahead and copy that sucker straight to your clipboard (seriously, it will disappear).
Also Note: This token is the equivalent to your GitHub password, so be careful and don’t hand it out to strangers!
Storing git credentials
By default, git credentials can be stored in
The schema to use in this file is as follows:
There are several other more secure ways to store or input git credentials temporarily, such
git-credential-cache, which will put your credentials in memory for a set
amount of time.
man gitcredentials for more info on ways to handle passing credentials to git.
man git-credential-store for more info on storing git credentials.
man git-credential-cache for more info on caching git credentials.