Host on GitHub

I have successfuly deployed Hugo as a GitHub Pages personal demo site with step-by-step Instructions.
But now I have two problems.

  1. My project repository on GitHub is empty.
    Username repository successfully updated from local folder. I have public files in username repository and empty project repository.
    I have local folder with hugo site and cant control all changes in project repository.
  2. I cant use (git push) without username and password every time.

Its hard to say without more info, but sounds more like a git issue. My first thought was that it sounds like you’re looking at a branch other than master, like gh-pages, or your local repository is linked to the wrong GitHub repository. running git remote -v will should what URL is configured as the remote.

Local repository is linked to the right repository.

$ git remote -v
origin (fetch)
origin (push)

I’m not familiar with the instructions you linked to at first (but I did happen to come across them the other day and they seems a bit strange to me.

I see what looks like your website in the repository.

If you wanted, you should be able to go into the settings for that repository, scroll down a bit till you see the Github pages, and select the website source as Master, which iirc is the first on the list. Then you’d have those files served up from I believe, but I’ve never set that up on my account.

If you wanted all these files in the hugosource repository, you’d need to go to the folder with the local copy of, change the remotes, and then push.

Or you could checkout a new copy of, change the remotes to hugosource, and then push.

1 Like

Your GitHub Pages site is currently being built from the  `master`  branch. [Learn more](

User pages must be built from the  `master`  branch.

If you wanted all these files in the hugosource repository, you’d need to go to the folder with the local copy of, change the remotes, and then push.

I use the script:


# If a command fails then the deploy stops
set -e

printf "\033[0;32mDeploying updates to GitHub...\033[0m\n"

# Build the project.
hugo # if using a theme, replace with `hugo -t `

# Go To Public folder
cd public

# Add changes to git.
git add .

# Commit changes.
msg="rebuilding site $(date)"
if [ -n "$*" ]; then
git commit -m "$msg"

# Push source and build repos.
git push origin master

I found very simple solution.
Creating public folder on local PC (command hugo), then copy or push it to the user repo.
Updating (pushing) project repo in the usual way without the script

Hi there,

The deploy script is for deploying the built files (the contents of the public folder) to GitHub Pages. It does not commit or push the source project files.

You can then run ./ "Your optional commit message" to send changes to <USERNAME> . Note that you likely will want to commit changes to your <YOUR-PROJECT> repository as well.

1 Like

Can I commit or push the source project files in the usual way after deploy script?

Assuming git is correctly configured in the source project, yes. Make sure you are performing the commit / push from the source project, not from inside the public folder.


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.