Member-only story

Github Access Tokens — 2FA

Daniel Ellis Research
2 min readFeb 16, 2021

--

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

  1. Click on your user icon (top-right)
  2. Select Settings
  3. From the left-hand menu, select Developer Settings
  4. Personal Access Tokens
  5. 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…

--

--

Daniel Ellis Research
Daniel Ellis Research

Written by Daniel Ellis Research

Research Software Engineer specialising in High-Performance Computing and Data Visualisation. — PhD in Atmospheric Chemistry and Masters in Theoretical Physics.

No responses yet