L&D series: Generate GitHub token
3 min readMay 21, 2022
Learning and Development chapter 16.
Hi, Learning & Development series is BACK !!! I hope we can study together more often.
What is token?
GitHub token or known as Personal access token is another way to authenticate GitHub other than using a password. We could use token when we try to hit GitHub API or send GitHub command via terminal.
Generate token
- Go to https://github.com/settings/tokens.
- Click Generate new token button.
- Input GitHub password.
- Input Note as a token name.
- Set Expiration date.
- Choose token access in Select scopes section. We can ticked all the checkboxes or select specific scope.
- Click Generate token button.
- Please read carefully in section Make sure to copy your personal access token now. You won’t be able to see it again!, because we have to re-generate different token with same purpose if we lost the token.
Note: GitHub token always starts with ghp_.
Where to store the token?
I’ll using GitHub secret for this article.
- Go to our repo link + /settings/secrets/actions.
- Click New repository secret button.
- Input Name for secret name.
- Input token in Value field.
- Click Add secret button.
Once secret key is created, we can only update the value without being able to see the previous key again.
- Click Update button.
- We can update to new token with empty previous token only.
What do you want to use the GitHub token for? — MperMperPisang.
Reference