Personal access tokens are the recommended way to access GitHub via command line or API. You can use the GitHub API to create a personal access token.
Go to your GitHub profile and go to Settings. On the left pane, you will see Developer settings.
In Developer Settings, click on Personal access tokens on the left pane.
On the right pane, click on Generate new token.
This will take you to the next page, where you can provide a name for your token. You can also select the access privileges that this token will have and choose an expiration policy for your token.
Once you generate your token, you can see it on the next page. This is the only time you will be able to see this token, so copy and keep it.
Now, you’ve successfully generated your personal access token. You can go ahead and use it to access Github via CLI or API. You can also use this token in place of your password to clone the repo.
Make sure to revoke the token in case it is compromised or the work it was intended for is complete.
Free Resources