How to Create and update your Github Personal Token Issue

danstano

Danstan-O

Posted on May 5, 2023

How to Create and update your Github Personal Token Issue

1. Creating a personal acccess Token token

Disclaimer: a personal access token should be treated as a password to GitHub.

GitHub supports two types of personal access tokens;

  • Fine-frained personal access tokens.

  • Personal access tokens (classic).

Github recommends that you use fine-grained personal access tokens instead of personal access tokens(classic) whenever possible.

You can follow the instructions in the link provided in references on how to generate an access token.

2. Updating an expired token

If you have a token that you have been using and it expires you can run the command git remote -v. This command shows you your current origin which will look like;
https://[PERSONALACCESSTOKEN]@github.com/[USERNAME]/[REPO].git.
There are two steps to update a expired token;

  • First, you have to remove the expired token by running the command git remote remove origin.

  • After removing the expired token you can run the command git remote -v to confirm that your token has been removed.

  • You now need to generate a new token following the steps highlighted in the creating a new token.

  • After creating a new token you need a to add a remote with your updated Github personal access token.

  • You can add it using the command git remote add origin + your new generated token as follows; git remote add origin https://[PERSONALACCESSTOKEN]@github.com/[USERNAME]/[REPO].git and you are done.

References

Creating a personal access token

💖 💪 🙅 🚩
danstano
Danstan-O

Posted on May 5, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related