Creating a token
- Click on your
- From the left-hand menu, select
Personal Access Tokens
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 viewing permissions to prevent other people from seeing or using your token.
git config --global credential.helper store
Finally, we need to enter the token itself.
We can do this by running a
git pull the command from our repository. Here we will be prompted to enter our username and then a ‘password’. This is our newly generated access token from GitHub.
Username for 'https://github.com': <user>Password for 'https://<user>@github.com': <your token>