Hugo 101: Deployment

I am trying to follow the deployment instructions and can’t figure out how to publish my site on github pages. I used the command from the point #6: git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public I think I created the submodule. However my github pages repository is still empty. https://github.com/pawsys/pawsys.github.io Would be grateful for ELI5 (explain like I am five) help. Here is my Hugo repository: https://github.com/pawsys/blog-git

1 Like

Have you created and ran the deploy.sh script? https://gohugo.io/hosting-and-deployment/hosting-on-github/#put-it-into-a-script

Also, you need to update the baseURL in your config file

I followed @zwbetz advice:

  • I changed baseURL
  • I added deploy.sh and run it.

Still there is nothing in https://github.com/pawsys/pawsys.github.io
Here is my Hugo repository: https://github.com/pawsys/blog-git What am I missing?

What output do you get after running the deploy script?

Deploying updates to GitHub...
Building sites … WARN 2019/05/14 14:16:41 .File.Dir on zero object. Wrap it in if or with: {{ with .File }}{{ .Dir }}{{ end }}

                   | EN
+------------------+----+
  Pages            | 60
  Paginator pages  |  0
  Non-page files   |  0
  Static files     |  7
  Processed images |  0
  Aliases          | 27
  Sitemaps         |  1
  Cleaned          |  0


Total in 38 ms
[master 91c69fa] rebuilding site Tue May 14 14:16:42 PDT 2019
 88 files changed, 279 insertions(+), 279 deletions(-)
 rewrite public/title/what-google-learned-from-its-quest-to-build-the-perfect-team/page/1/index.html (100%)
 rewrite public/title/wisdom-is-just-covering-blindspots-in-your-mentalmodel-map-of-knowledge/page/1/index.html (86%)
Enumerating objects: 288, done.
Counting objects: 100% (288/288), done.
Delta compression using up to 8 threads
Compressing objects: 100% (104/104), done.
Writing objects: 100% (164/164), 13.72 KiB | 1.14 MiB/s, done.
Total 164 (delta 74), reused 0 (delta 0)
remote: Resolving deltas: 100% (74/74), completed with 35 local objects.
To https://github.com/pawsys/blog-git
   0c45d25..91c69fa  master -> master```

Hmm. Nothing stands out to me as an obvious issue. Hopefully someone with more GitHub Pages experience can help you.

1 Like

When you ran git submodule add -b master git@github.com:<USERNAME>/<USERNAME>.github.io.git public, what exact command did you run. Also, since the command is replacing public did you remove that per step 5? Should be something like:

git submodule add -b master git@github.com:pawsys/pawsys.github.io.git public
1 Like

I realized I added a space after git@github.com. My command looked like this: git submodule add -b master git@github.com: pawsys/pawsys.github.io.git public

So how can I fix it?

I just deleted: public and .gitmodules

and run:
git submodule add -b master git@github.com:pawsys/pawsys.github.io.git public

and I received:
fatal: not a git repository (or any of the parent directories): .git

That implies you are not in a git repo, and that would be a requirement for running the command. The final .git in the error is indicating what it is looking for where you are. On mac or linux, I would run a ls -la to check for hidden folders like that and just confirm it exists. Otherwise, you can just do a git clone to pull the repo to your local drive and try again.

1 Like

to make sure I cloned all of the repository to a new folder: https://github.com/pawsys/blogHugo

I deleted the public folder

When I run the command:
git submodule add -b master git@github.com:pawsys/pawsys.github.io.git public

I get this message:

warning: You appear to have cloned an empty repository.
fatal: 'origin/master' is not a commit and a branch 'master' cannot be created from it
Unable to checkout submodule 'public'

Is this how my .gitmodules file should look like?

[submodule "public"]
	path = public
	url = https://git@github.com/pawsys/pawsys.github.io
	branch = master

I deleted the pawsys.github.io.git repository and created it again. Now when I run the the command:
git submodule add -b master git@github.com:pawsys/pawsys.github.io.git

I get this message:

A git directory for 'public' is found locally with remote(s):
  origin        git@github.com:pawsys/pawsys.github.io.git
If you want to reuse this local git directory instead of cloning again from
  git@github.com:pawsys/pawsys.github.io.git
use the '--force' option. If the local git directory is not the correct repo
or you are unsure what this means choose another name with the '--name' option.

What should I try next?

Is it possible that somehow pawsys.github.io remote repository is not connected to a local one?

You need to ask this question the other way around: Could it be that your local repo copy is not connected to pawsys.github.io.

First of all: I am not sure about the .io part - all my github urls resolve to .com. At least in regards to repositories.

Run the following command and see what the output gives you:

git remote

It will list all connected repos. From there you go. The remote documentation for git is here: https://git-scm.com/docs/git-remote

Forget the .io part of my answer above. I checked your repo url and it states that the repo is empty. Add a readme or a .gitignore, then try to restart the whole adventure. You can’t clone empty repositories.

If you have the whole site local, you probably never done a git push origin to upload it into the repo.

1 Like

Thanks for all the help here. I deleted all the repositories and started over and this time I managed to figure it out. I tweaked a couple of sentences from the Docs that led me astray. I include them in the push request.

1 Like

Thanks. The link markdown was broken, because you had the syntax as [](()) but it needed to be [](). Fixed it.

1 Like

I am having a problem with the deployment. I am running the deploy.sh script in the root folder of my hugoBlog repository and instead update showing up on my pawsys.github.io GitHub pages repository the blogHugo repo gets updated. What I am doing wrong?

is it possible that forestry messed up the settings of git submodule?

I fixed it by creating new repositories from scratch. Not sure what happened. Maybe when I was testing forestry they tweak something in submodule settings.