Member-only story
Github Access Tokens — 2FA
With the introduction of two-factor authentication, we are now required to change the way we access our repositories. There are now two main methods to upload to Github: using ssh keys or access tokens. This page describes the latter.
Creating a token
- Click on your
user icon
(top-right) - Select
Settings
- From the left-hand menu, select
Developer Settings
Personal Access Tokens
- Right-top:
Generate New Token
Copy and SAVE the token, you will not get to view it again without generating a new one!
Storing the token
Caching for a TEMPORARY period in time
If we wish to store our token for a fixed period in time we may cache
it with a predefined timeout.
git config --global credential.helper 'cache --timeout=31540000'
Here the timeout corresponds to the number of seconds in a year, you can choose a more suitable duration for your work.
Saving the token in $HOME
It is also possible to save it within your home directory as a plaintext file, serving much the same purpose. Just note that you may want to change the…