Trusted answers to developer questions

How to create a personal access token for GitHub access

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

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.

widget

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.

RELATED TAGS

git
github

CONTRIBUTOR

Anjana Shankar
Copyright ©2024 Educative, Inc. All rights reserved
Did you find this helpful?