Search code examples
gitgithubgit-submoduleshugo

git & hugo - problem with creating git submodule to github


According to this instruction, I entered the following into git,

git submodule add -b master https://github.com/<USERNAME>/<USERNAME>.github.io.git public

but 'public' does not have a commit checked out appears as result.

I am quite new to this field, so I need explanations on some basic things. What exactly needs to be done with the public directory, and what should I do to solve this error?


Solution

  • The link you provided shows you how to keep hugo files and the generated website files separated in different repos, i.e. the code in github.com/username/blog and website in github.com/username/username.github.io.

    I feel that all this seems too complicated to you. The simplest way to serve a hugo website is by using only one repository. Just follow this:

    1. create a repository named username.github.io
    2. make your hugo site in this repo
    3. run hugo build. This will generate the static website in a public folder.
    4. Commit and push changes. The static files in the public folder will be automatically served.