How do you authenticate on github
How do you authenticate on github
Could someone provide an explanation how GitHub authentication should be managed? Should one choose ssh key or personal access token, if the latter should one opt for a fine-grained or a classic token? Moreover, is there a method to store the token to avoid rewriting it every time you for example push to the repository? (I am using git cli not the desktop windows program)
Re: How do you authenticate on github
I have a classic token which works fine, though my understanding is "fine-grained" tokens are considered safer/more secure since they provide much more control over exactly what the token has access to (i.e. how much is at risk if it falls into the wrong hands). For example, fine-grained tokens let you use different tokens for different repositories so if one gets compromised the others are still safe. But if you're not concerned about any of that, classic token should be fine.
There is a way to store the token in Git CLI. I used to use it all the time:
The next time you use the token, Git will store it so you won't have to type it again. But this too has similar security implications, if someone gets access to your PC, they theoretically have unlimited push access to your repo, so it may be preferable to store it in a password manager or something. However, this may be too unlikely to matter depending on your situation.
There is a way to store the token in Git CLI. I used to use it all the time:
Code: Select all
git config credential.helper 'store'
- a_regular_pear
- Posts: 15
- Joined: Sat Dec 31, 2022 6:00 pm
Re: How do you authenticate on github
I personally just use ssh keys. It takes a bit of time to setup initially but then it just works.