In this article I run through how to setup Git and Github ready for developing on a Chromebook. This article is the third in a series of articles about doing geeky things with Chromebooks - from software development to retro gaming.
Setting up Git and Github ready for development are pretty simple, but amongst the most important setup tasks that you will complete on any machine. Doing so enables you to version control your code, and to pull code from and push code back to your remote repository (in this case Github, though there are alternatives). Really I expected there to be nuances, but in reality this workflow is identical to the process on the various Linux distributions or on MacOS.
Remember from the first article in this series, the Chromebook already had Git installed when when turned on the Linux development environment. The first thing that I will do is to configure the Git user in the terminal.
git config --global user.name "Your Name"
git config --global user.email "firstname.lastname@example.org"
I want to be able to push code to my github repositories and pull code back, so I need to generate an ssh key. To do that:
ssh-keygen -t ed25519 -C "email@example.com"
I’m happy to use the default storage location, and I do not want to use a passcode with the key, so I just click return through the next three prompts. The key is generated, and pictographic representation printed.
Next I turn on ssh-agent, and add the key to it.
eval "$(ssh-agent -s)"
If you opted for a different key identifier, you will need to remember to change the key idea in this code also.
I also need to add the ssh key to my Github account - so I concatenate the key to terminal ready for copying and pasting later.
Now in my Github account I navigate through to my account settings, scrolling through to the access section.
Heading into the SSH and GPG keys section, I click on the green button to add a new SSH key.
Here I paste in the concatenated SSH key that I copied earlier, clicking the ‘Add SSH Key" button that will appear below the key box in the screenshot below.
Finally, having added the SSH key to Github, I finish up for the night by testing that it works:
ssh -T firstname.lastname@example.org
If the key has installed correctly, the same text as below should appear, stating that you have successfully authenticated, but Github does not provide shell access.
A simple and straightforward walkthrough that is essentially identical on Chromebook to the process on other machines. Stay tuned to see what I setup on Chromebook next, and if there is anything that you would like me to try to get working, raise it in the discussion section below.