GitHub authentication from command line

If you are using GitHub to store your code and getting “[GitHub] Deprecation Notice” emails stating:


Basic authentication using a password to Git is deprecated and will soon no longer work.

You have until August 2021 to change your authentication method.

Since I don’t use a desktop environment with a libsecret credential store, I chose to use the (open-text) file store method for a personal access token. The method of setting this up was:

=== GITHUB using Personal Access Token

1) Browse to github.com/<your_user_name>, 
   Pull down menu of account icon on top right: 
   Settings->Developer settings->Personal access tokens, 
   Generate new token, with all privileges, 
   Copy it down

2) On your device i.e. GoPiGo3/BrickPi+, 
   tell git to use a file-store as credential holder:
   $ git config --global credential.helper store
   (btw, I did not use libsecret because I desire command line git access, 
   not a desktop environment or tool such as VScode)

   Then perform a "git push", 
   fill in git username, and the git personal access token for the password.

   The file ~/.git-credentials is created with the username and personal access token so you never have to type the token again. 

BTW, If you do the “git config --global store” before you clone your repository down to your device, it will get set up from the start. The above “git push” step is for an existing repository already on your device.

2 Likes

Thanks. I haven’t gotten that notice, but it’s been a long time since I’ve set up my local repositories, so I actually don’t remember how I did it.

I really should just sync up my robot’s ‘src’ folder with GitHub - I’d have much better version control that way. This is probably the nudge I need.
/K

1 Like

Good notice.

I think my repo is already set up the correct way, but I should check too.

Thanks for the update!

1 Like

I didn’t get the notice either but I already use a solo key.

1 Like