Greetings!
I have successfuly deployed Hugo as a GitHub Pages personal demo site with step-by-step Instructions.
But now I have two problems.
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.
I cant use depoy.sh (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.
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 https://mxlid.github.io/ 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 mxlit.github.io, change the remotes, and then push.
**Source**
Your GitHub Pages site is currently being built from the `master` branch. [Learn more](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/).
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 mxlit.github.io, change the remotes, and then push.
I use the deploy.sh script:
#!/bin/sh
# 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
msg="$*"
fi
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 deploy.sh.
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 ./deploy.sh "Your optional commit message" to send changes to <USERNAME>.github.io . Note that you likely will want to commit changes to your <YOUR-PROJECT> repository as well.
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.