Authentication
For some git actions, you may be required to input git credentials. GitHub does not accept your account password here: if the terminal asks for a password when you clone or push, it wants a personal access token (PAT) instead. To make one:
- Go to your profile picture in GitHub (upper right) > Settings > Developer settings (bottom left) > Personal Access Tokens (left) > Tokens (classic) > Generate new token (upper right) > Generate new token (classic).
- Give the token a name in the “Note” field, choose an expiration, check the
reposcope, and click “Generate token”. - THEN, COPY AND PASTE YOUR TOKEN SOMEWHERE SECURE.
- Once you do this, when you go back to the Personal access tokens page, your new PAT should show up.
- Use the copy and pasted token for the password entry above in the terminal, and your clone or push should go through.
The steps above make a classic token. GitHub recommends fine-grained tokens where you can use them, because they can be limited to chosen repositories.
There are additional tools that you may choose to use to make this process easier, such as the GitHub CLI (gh auth login) or Git Credential Manager. These tools can allow you to cache your credentials so that you only need to authenticate your GitHub account once, and your credentials will be remembered for the future.