Nextpertise a journal of interesting technical ideas . . .

Github setup

by Brent Stewart on Sunday, Feb 25, 2024

Github screenshot Recently I had to rebuild my desktop. Backups were my friend, and recreating my rig and loading files went without a hitch. My git directory restored, but I needed to reconnect them to Github. I decided to start with fresh pulls, so I renamed git to oldgit and pulled down my repos (including the one that’s used for this website).

Once setup, Github is easy to use, but I always forget how to set it up and have to rediscover the process. Hopefully, this quick step-by-step will help you avoid that difficulty (and will help me the next time I need to do it)!

Cloning the repo

In this case, my repos already exist. I started by cloning from github to have a clean current copy. I’m using this website as an example.

git clone https://github.com/brentstewart/nextpertise.git

Setting

Next I created a personal token. I clicked my user icon (my smiling face) in the upper right hand corner of the Github site and chose Settings (near the bottom). In the settings menu, choose <Developer settings> at the bottom. This gets you to a menu that let’s you chose Personal access tokens. I use classic tokens - the “fine grained” option allows for permisssions and would be more appropriate if there was a team of people maintaining this site.

At this point, it’s as simple as clicking Generate new token and then copying the text string down for later use. Github token setup

Git Access to Github

You can test the new setup with an ssh to Github. You should be prompted for your Github username and then a password. Use the token from above for the password.

ssh -T git@github.com
Hi brentstewart! You've successfully authenticated, but GitHub does not provide shell access.

Credentials can be saved (so you aren’t prompted with each interaction).

    git config --global credential.helper store
Danger
This cute command saves your creds to disk in plain text. Be careful!

Once the token is setup, push and pull commands should work without forcing your to reauthenticate. A typical workflow of syncing to git might be:

git add .
git commit -m "Another commit"
git push



References:
  

Recent articles related to these tags:
git
Share this article:   
Tweet