Still haven’t sorted out connecting Lynn’s PC to Netlify (left undone last post). But, let’s get that GitHub repository (repo) onto Lynn’s PC.

Install Git

Lynn, if you haven’t yet installed Git you will need to do so. I suggest you take a look at this tutorial: “How to Install and Use Git on Windows”.

I use Git from the command line. I.E. in a Powershell tab in Windows Terminal. And, that’s how these instructions will be written. Though I may look at providing an alternative down the road. One such option is to install GitHub Desktop which will also install Git and provide you with a GUI for working with your repository. Though either way there will still be a bit of a learning curve.

Terminal

Also, if you do not have the new Windows Terminal installed, I recommend you do so now. It is installed by default on Windows 11. If you are using Windows 10 you will need to install it.

To see if you have it installed, search the Start Menu for ‘Terminal’. If you find it, good to go. For easier access, I suggest you pin it to the Start Menu. That will create an icon in the area to the right of the long menu, and save you a bit of scrolling when you need to open Terminal. Just ‘right click’ the Terminal entry in the menu and select ‘Pin to start’.

If you do not have it installed, you can get it from the Microsoft store. And you might find this article of some use: “Install and get started setting up Windows Terminal”.

SSH Keys

I Gave You Copies of the SSH Keys

Now, I have hopefully given you copies of the SSH keys I generated to use with your GitHub account. If so, you will need to put them in the correct directory. I can’t tell you exactly where that is. But Windows can.

If you have Terminal installed you can simply open it. That should open a Powershell command window in the first tab. You will see something like the following.

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\bark>

Powershell will be opened in your ‘home’ directory. In your case bark will be replaced with something different. If you have a .ssh directory it will be below your home directory. A simple Get-Childitem -Path .ssh or dir .ssh should tell whether or not it is there.

In my case.

PS C:\Users\bark> Get-Childitem -Path .ssh

    Directory: C:\Users\bark\.ssh

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        2023-10-03     15:31            338 config
-a----        2023-10-02     15:33            411 id_ed25519
-a----        2023-10-02     15:33            101 id_ed25519.pub
-a----        2023-10-04     14:11           1262 known_hosts
-a----        2023-10-02     15:24            411 lb_dbls
-a----        2023-10-02     15:24             96 lb_dbls.pub

If it is not present you will need to create it. I am showing Powershell commands. mkdir .ssh should also work.

PS C:\Users\bark> New-Item -ItemType Directory -Path .ssh

    Directory: C:\Users\bark

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2023-10-04     15:39                .ssh

Once you have a .ssh directory, copy those SSH key files into it. However if…

I Did Not Give You Copies of the Keys

If this is the case, life is going to get a bit more complicated. You will need to use existing keys or create new keys and register the public key in your GitHub account. This is going to be a bit of a repeat from previous posts.

If you already have keys in the .ssh directory. You can perhaps use one of them. If you do not, create a new set of keys—after creating the .ssh directory if necessary (see above).

In the .ssh directory run the following command. I accepted the defaults by hitting enter for each prompt. Make sure you enter the correct e-mail address. And of course your keys will be different, as will the randomart image.

PS C:\Users\bark\.ssh> ssh-keygen -t ed25519 -C "lynn@b###.ca"
Generating public/private ed25519 key pair.
Enter file in which to save the key (C:\Users\bark/.ssh/id_ed25519):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\bark/.ssh/id_ed25519.
Your public key has been saved in C:\Users\bark/.ssh/id_ed25519.pub.
The key fingerprint is:
SHA256:c0--xxx--U lynn@b###.ca
The key's randomart image is:
+--[ED25519 256]--+
|       .+.o.  .  |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|                 |
|          ++o   .|
+----[SHA256]-----+

Now let’s get a copy of the public key into the clipboard.

PS C:\Users\bark\.ssh> Get-Content C:\Users\bark\.ssh\id_ed25519.pub | Set-Clipboard

Next you need to log into your GitHub account. Hopefully I gave you the necessary credentials. If not you will need to do a password reset using the lynn@b###.ca e-mail account. Then follow the instructions in this GitHub document: “Adding a new SSH key to your GitHub account”.

Clone the lb_dbls Repo

This process will bring a copy of the blog repository that I had uploaded to your GitHub account down to your PC and at the same time “connect” the two repositories so you can save changes to the GitHub repository.

I am going to use the SSH version of the the remote URL to do the clone. I am letting the local repository’s directory be the name of the remote repository. If you wish to use a different directory name, add a space and the directory name you want after the command below. Also make sure to replace the ### with the remainder of your surname (lowercase).

PS R:\hugo> git clone git@github.com:LynnB###/lb_dbls.git
Cloning into 'lb_dbls'...
remote: Enumerating objects: 718, done.
remote: Counting objects: 100% (718/718), done.
remote: Compressing objects: 100% (334/334), done.
Receiving objects:  80% (575/718)used 718 (delta 272), pack-reused 0R
Receiving objects: 100% (718/718), 563.17 KiB | 2.29 MiB/s, done.
Resolving deltas: 100% (272/272), done.

Hugo Needs Updating

Tried to run a local Hugo web server in the new local repository.

PS R:\hugo\lb_dbls> e:\appWeb\hugo\hugo server -D -F
...snip...
Error: command error: failed to load modules: module "ghostwriter" not found in "R:\\hugo\\lb_dbls\\themes\\ghostwriter"; either add it as a Hugo Module or store it in "R:\\hugo\\lb_dbls\\themes".: module does not exist

My .gitignore was configured to ignore the Hugo themes directory in the blog repository. I figured I could always re-install the themes if necessary. And, didn’t want to save them to the remote repository. But, don’t know how Lynn is going to feel about adding the themes to the blog directory. Not difficult but…

That said, here we go.

I have two themes in the config file:

theme = ["hugo-video", "ghostwriter"]

Not sure Lynn will need the video theme, but I think we’ll keep it just in case.

PS R:\hugo> cd r:\hugo\lb_dbls
PS R:\hugo\lb_dbls> New-Item -ItemType Directory -Path themes
PS R:\hugo\lb_dbls> cd themes
PS R:\hugo\lb_dbls\themes> git clone https://github.com/jbub/ghostwriter
Cloning into 'ghostwriter'...
remote: Enumerating objects: 1696, done.
remote: Counting objects: 100% (93/93), done.
remote: Compressing objects: 100% (56/56), done.
remote: Total 1696 (delta 45), reused 60 (delta 29), pack-reused 1603
Receiving objects: 100% (1696/1696), 1.64 MiB | 6.73 MiB/s, done.
Resolving deltas: 100% (896/896), done.

PS R:\hugo\lb_dbls\themes> git clone git@github.com:martignoni/hugo-video.git
Cloning into 'hugo-video'...
remote: Enumerating objects: 147, done.
remote: Counting objects: 100% (63/63), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 147 (delta 46), reused 40 (delta 34), pack-reused 84R
Receiving objects: 100% (147/147), 49.79 KiB | 1.04 MiB/s, done.
Resolving deltas: 100% (62/62), done.

## Quick test
PS R:\hugo\lb_dbls\themes> cd ..
PS R:\hugo\lb_dbls> e:\appWeb\hugo\hugo server -D -F
Watching for changes in R:\hugo\lb_dbls\{archetypes,content,layouts,static,themes}
Watching for config changes in R:\hugo\lb_dbls\config.toml
Start building sites …
hugo v0.119.0-b84644c008e0dc2c4b67bd69cccf87a41a03937e+extended windows/amd64 BuildDate=2023-09-24T15:20:17Z VendorInfo=gohugoio

                   | EN
-------------------+-----
  Pages            | 59
  Paginator pages  | 11
  Non-page files   | 56
  Static files     | 10
  Processed images |  0
  Aliases          | 16
  Sitemaps         |  1
  Cleaned          |  0

Built in 299 ms
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

The test on the development server failed. The themes CSS file could not be found. Turns out from my version of the theme to the one I cloned above the file name had changed from styles.css to site.css. I updated the layouts\partials\header.html in the local repo to use the new name and we were good to go. Pushed the change to the remote repository. So things should work for Lynn in future.

Is Fini

I think that’s it for this one. Lots covered, but it basically accomplishes one thing: getting the blog site into a local Git repository.

Amazes me how difficult it is to cover everything I have done to get the Hugo blogs working. Locally, with Netlify and on my own ISP account. And a goodly portion of that setup has yet to be documented.

Resources