Using Personal Access Tokens with GIT and GitHub to Push.

Obielum Godspower
3 min readAug 20, 2021

--

If you’re reading this article, you probably already know what Git and Github are but i’d go over the terms for those who might not.

GIT: is a widely used distributed VCS(Version Control System), This means that every collaborator of a particular project will have a history of the changes made on their local machine.

GITHUB: is a widely used platform for version control that uses Git as it’s core. It let’s you host the remote version of a particular project where other collaborators can have access to it. In addition, it is a social platform where you can find a lot of open-source projects with their codebases.

ACCESSING YOUR GITHUB REPOSITORY USING GIT

A different variety of actions can be carried out using git e.g push,pull,clone etc but before any of this can be done we must sync our local and remote repositories using

now the repositories sync process has begun but if we try to carry out a function, e.g push, a prompt will pop up asking for your github username and password to finalize the sync and after you have input your credentials, you will notice an error (regardless of if your credentials are correct). It should look exactly like:

This is because Github released a statement stating that as from August 13th, 2021. Password authentication will no longer be accepted when trying to sync your local repository to your github repository and instead will be replaced with the use of a PERSONAL ACCESS TOKEN. Not to worry, I will now show you how to get your Personal Access Token and use it to sync your local and remote repositories.

To get your Personal Access Token, go to your page on github, on the top right corner and click on the circle which has a dropdown arrow attached to it and go further to click on settings

While on Settings, on the left side of the page, Theres a sub-heading which says Account settings, scroll to the bottom and click on Developer Settings, While in the developer Settings page, click on Personal Access Tokens. On the right side of the Personal Access Tokens Page, click “Generate New Token”

and a new page will pop up titled “New Personal Access Token” and from this point all you have to do is select the expiration period of the PAT(how long you want it to be valid for) and fill a description box which is titled “Note” to state what you would be using the access token for, then you select the scope for which we will use the access tokens. Since we’re working with repositories all you have to do is tick the “repo” box and scroll

all the way to the bottom then click “Generate Token” and you will be able to see your Personal Access Token but you must copy and save it somewhere secure because as soon as you close the page you will no longer be able to see it.

Finally, when you try to carry out any command, e.g push, a popup will prompt you to put your Github Credentials and this time instead of putting your password in the password form, you will input your Personal Access Token and it will work just fine!

--

--