- http://jasonlawrencewong.com/blog/setupghpages
- https://gohugo.io/hosting-and-deployment/hosting-on-github
In my deploy file is a version tag included. This Version is shown on my Page together with the build date. The Version tag shows me in my Hugo repo (not the Github Pages repo) which Website version is live.
# Create a new orphand branch (no commit history) named gh-pages
git checkout --orphan gh-pages
# Unstage all files
git rm --cached $(git ls-files)
# Grab one file from the master branch so we can make a commit
git checkout master README.md
# Add and commit that file
git add .
git commit -am "INIT: initial commit on gh-pages branch"
# Push to remote gh-pages branch
git push origin gh-pages
# Return to master branch
git checkout master
# Remove the public folder to make room for the gh-pages subtree
rm -rf public
- Create new empty repo on Github
- Create CHANGELOG.md on the Github GUI
- Create branch
gh-pages
on the new repo with the GUI
# Add the gh-pages branch of the repository. It will look like a folder named public
git subtree add --prefix=public git@github.com:AngelCrawford/profilecard-public.git gh-pages
# Pull down the file we just committed. This helps avoid merge conflicts
git subtree pull --prefix=public git@github.com:AngelCrawford/profilecard-public.git gh-pages
# Run hugo. Generated site will be placed in public directory
hugo
# Add everything and commit
git add --all
# Commit and push to master
git commit -am "Updating site" && git push origin master
# Push the public subtree to the gh-pages branch
git subtree push --prefix=public git@github.com:AngelCrawford/profilecard-public.git gh-pages
- Create deploy.sh File
- Use in Terminal
bash deploy.sh "my commit msg" "my_tag"