26 December 2019

#038 - Hitting the Reset Button #100DaysOfCode

Hello World! I am well. I recently hit the reset button on my workstation. I now sport a Samsung 2TB M.2 NVMe SSD, which is a big upgrade from my 512GB SSD.

It was a lovely feeling to deploy a clean copy of Windows 10 Pro to my primary hard disk drive. One of the reasons for rejuvenating my workstation PC is the lack of hard drive space for creative and development purposes. The other reason is that I am anticipating a potential move away from the nest, but I will learn of my new adventures come 2020, God willing.

I also pushed the big red reset button to my coding workflow. Currently, I have been using a cloud storage platform with end-to-end encryption to house my source code and projects. This past week, I have since gutted out my old repos on GitHub to create new master repos.

I realised that I was maintaining my repos like a complete novice, as every commit and push resulted in a new clone of my name and differing e-mail address. It also explains why my GitHub activity calendar wouldn't fully populate with green squares to reflect my true contributions on GitHub.

As a coding newbie, I consulted GitHub's documentation wiki. I used the following guide to start from scratch and generate a new SSH key pair and assign this to a SSH agent on my local workstation PC.

Source: https://help.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

I soon realised from the wider community that there is a technical issue when using a SSH key pair with a passphrase with Git GUI clients. The same issue was apparent when I tried to clone my own private repos from GitHub via Visual Studio Code.

It should be noted there are no issue when working from the command line from start to finish. Everything is hunky-dory from the command line, but when using the GUI  tools that mere mortals have at their disposal - SSH keys with passphrases don't function nicely out of the box. Why? Seemingly, this has been raised with Microsoft since October 2016.

You either adopt a command line only approach, or you remove the passphrase from the SSH key. I opted for the latter, but I am using a higher bit value to give me a false sense of security. However, I am also using basic Git commands via the Terminal within VS Code and from the Git Bash terminal. Once I develop a confident grasp of the commands, I will return back to using a passphrase on the same SSH key and fully depend on the command line exclusively - unless, of course, Microsoft can fix the bug for all developers. And yes, I have consulted many tutorials of folk utilising SSH keys with passphrases, but the setup doesn't work for me.

Anyhow, I am giddy to be using GitHub again, as I want to focus my development and time on some side projects for 2020.

To those who want to avoid my novice mishap, when working with Git-integrated applications. First, you want to ensure that your Git config file is using the same profile name and e-mail address as your primary GitHub account. It would also appeal to developers who are likely to develop across multiple devices using the same Git credentials throughout your coding workflow (i.e. laptop, desktop, etc).

Within Git, be sure to define your user.name and user.email to match the same name and e-mail address as your primary GitHub / GitLab account. I opted to use the noreply e-mail from GitHub, as I don't want to reveal my personal e-mail address, which I suspect would be attached to repo commits and config files.

$ git config --global user.name "John Appleseed"
$ git config --global user.email "[email protected]"

You can confirm these details from the global Git config file and echo the values with the following commands.

$ git config --global user.name
John Appleseed
$ git config --global user.email
[email protected]

I also used the same noreply e-mail address when generating a new SSH keygen.

ssh-keygen -t rsa -b 4096 -C "[email protected]"

You may also find it useful to generate a GPG key to your GitHub account. With a GPG key, you can verify signature commits within Git. I suspect this option is more appreciated when collaborating with others across different projects and repos. For a solo developer, I don't think it is necessary, but I am choosing to learn another feature as I want to learn more about software development as a whole.

~Richard