[SOLVED] Installing theme with git submodule

I have never used git before but decided to give it a try since the theme I want to use suggests the installation via git. In the theme docs it says to enter

$ git submodule add git@github.com:dzello/reveal-hugo.git themes/reveal-hugo

but when enter this in the git command line, I am getting this error:

$ git submodule add git@github.com:dzello/reveal-hugo.git themes/reveal-hugo
fatal: not a git repository (or any of the parent directories): .git

Am I missing anthing? And what is the difference between installing a theme this way and downloading the zip and unpacking it into my themes folder manually?

You need to use the repository URL to install a theme submodule.

From the root of your Hugo project execute the following:

git submodule add https://github.com/dzello/reveal-hugo.git themes/reveal-hugo

I tried it but I am still getting this error. Sorry this might sound dumb, but do I need to configure git somehow or set up anything? I just downloaded it and opened up the command line.


If you’ve never used git before, you may need to first run git init in the root of your project directory. Read more about git here: https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init

As @pointyfair already mentioned it seems you’ve to turn the directory of your Hugo website into a Git repository with git init first. You can’t modify a Git repository (e.g. by adding a submodule) when it is missing.

The presumption is that all Hugo sites live in a git repo, and therefore the prudent way to add themes is via a git submodule. However, @lolli, this is not the case for you.

You can follow what the others said, git init and proceed, but you don’t have to. You can just download that theme and put it in themes.

But there is definitely a momentum to using git for deployment, so the more you know about git, the easier publishing with Hugo will be.

I personally don’t like that about static site generators, we lean really heavily on a VCS, which is just not user friendly. On the other hand, Hugo is kinda advanced, so… swings and round-a-bouts! :slight_smile:

1 Like

Thank you everyone! Yes, I am not planning on using Github to host my site…I ahve my own vserver. So downloading the theme into the themes folder makes more sense I guess!