Sitemap
Sparisoma Viridi

Sparisoma Viridi

butiran-x.github.io

GitHub personal access token

Set it and use it with Git

5 min readSep 18, 2023

--

Steps to generate and use GitHub personal access token are given here in brief.

Note

Is your GitHub username is username change every rrkurnova with your username.

Generate

Go to your GitHub profile page, e.g. https://github.com/rrkurnova.

Press enter or click to view image in full size

Click on the avatar icon on the top right corner.

Press enter or click to view image in full size

Scroll down to find Settings.

Press enter or click to view image in full size

Click Settings.

Press enter or click to view image in full size

Scroll down to have Developer settings on the left.

Press enter or click to view image in full size

Click Developer settings.

Press enter or click to view image in full size

Expand Personal access tokens and choose Tokens (classic).

Press enter or click to view image in full size

Click Generate new token button on the right.

Press enter or click to view image in full size

Choose Generate new token (classic).

Press enter or click to view image in full size

Confirm access.

Press enter or click to view image in full size

Fill Note field to remind you the purpose of this token, e.g. lecture-notes.

Press enter or click to view image in full size

Scroll down and check some option.

Press enter or click to view image in full size

Change Expiration to 60 days and check repo and workflow, then scroll down.

Press enter or click to view image in full size

Click Generate token button.

Press enter or click to view image in full size

Personal access token is created. Save it since it will not display again. Refresh the page.

Press enter or click to view image in full size

Now you have only the list of your tokens, but not their value.

Config

Go to Downloads folder again.

Press enter or click to view image in full size

Right click, select Show more options, and choose Open Git Bash here.

Press enter or click to view image in full size

Type git config --global user.name "Raro Kurnova" then press enter.

Get Sparisoma Viridi’s stories in your inbox

Join Medium for free to get updates from this writer.

Type git config --global user.email "rrkurnova@gmail.com then press enter.

Press enter or click to view image in full size

Type git config --list to see the information.

Press enter or click to view image in full size

The last two lines show the recently added information.

Clone

Now it is time to clone there repository https://github.com/rrkurnova/lecture-notes. In the Donwloads open Git Bash, type

git clone --recursive https://github.com/rrkurnova/lecture-notes lecture-notes
Press enter or click to view image in full size

It will make new folder name lecture-notes inside Downloads.

Press enter or click to view image in full size

Copy hugo shortcut to lecture-notes and click the it to open.

Press enter or click to view image in full size

And from Git Bash type cd lecture-notes to enter lecture-notes folder.

Press enter or click to view image in full size

Now, both cmd and Git Bash are already in lecture-notes folder.

Add to Git

First remove current remote origin

git remote remove origin

Than add again with <access-token-name> and <access-token-value> as follow

git remote add origin https://lecture-notes:ghp_sf...lhu@github.com/rrkurnova/lecture-notes.git

Remember that the token note was lecture-notes and the value was ghp_sf...lhu.

Edit, commit, push

Edit LICENSE file with right click and Edit with Notepad++.

Press enter or click to view image in full size

Now Notepad++ is showing its content.

Press enter or click to view image in full size

Change the copyright holder to your name, e.g. Raro Kurnova.

Press enter or click to view image in full size

Press CTRL+S to save it. Now to to Git Bash. Type git status to see what are changed.

Press enter or click to view image in full size

It shows that LICENSE file is changed. Commit the change with

git commit -a -m "change copyrigh holder"
Press enter or click to view image in full size

Type again git status.

Press enter or click to view image in full size

Now type

git push --set-upstream origin main

to push the change to remote repository in GitHub.

Press enter or click to view image in full size

After the first time using git push --set-upstream origin main, the option is no longer need. You can simply type git push.

Press enter or click to view image in full size

Now the remote LICENSE file has been changed due to local change pushed to GitHub.

--

--