Coding - github Authentication

Created by: Lester Caine, Last modification: 28 August 2025

The one part of this I failed to appreciate initially is that for the public repositories we need to use the https://github.com links rather than the ssh ones using ssh into git@github.com. Some of the ssh links I was trying to pull from were failing to work and git also failed to report that which added to the agrivation. For those links a switch to using the ssh://git@ssh.github.com:443 link did work, but all of the SSH stuff requires that a user has the following set up properly. I have now switched the submodules in my bitweaver repository to use the https:// links.

A quick sanity check from a useful blog by Thomas Thornton

git remote -v

This should return the correct github address for the directory one has currently navigated to.

h auth refresh

First problem was that the gh function was not loaded, and then after loading it I got another couple of errors which I failed to make a note of, but now this process runs cleanly

! First copy your one-time code: nnnn-nnnn
Press Enter to open https://github.com/login/device in your browser... 
✓ Authentication complete.

Previously I had jumped through another few steps including ...

git config --global user.name "lsces"
git config --global user.email "lester@lsces.co.uk"
git remote set-url origin https://github.com/lsces/bitweaver.git
git config --global --add safe.directory /srv/website/bitweaver

In addition, I needed to create a suitable SSH key which used the following script

ssh-keygen -t ed25519 -C "lester@lsces.co.uk"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
git fetch origin
ssh -T git@github.com

And finally I am not sure where this fits into the jigsaw but I think it post dates the set-url above.

git remote set-url origin "https://lsces:github_pat_@github.com/lsces/bitweaver.git

At some point I will tidy this, but now I have it working it's difficult to check just what is necessary, Any input welcome and at some point I will switch the comment facility back on to open a the discussion ... that is providing it does not get overwhelmed with crap again.