https://github.com/giorgosk/hugo-quick
Hugo quick install and deployment to github project pages
https://github.com/giorgosk/hugo-quick
deploy github-pages hugo testing
Last synced: 8 months ago
JSON representation
Hugo quick install and deployment to github project pages
- Host: GitHub
- URL: https://github.com/giorgosk/hugo-quick
- Owner: GiorgosK
- Created: 2019-04-13T13:03:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-08T23:05:15.000Z (over 6 years ago)
- Last Synced: 2025-02-17T19:22:54.353Z (over 1 year ago)
- Topics: deploy, github-pages, hugo, testing
- Homepage: https://giorgosk.github.io/hugo-quick/
- Size: 304 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hugo deploying to github project pages
https://[username].github.io/[project-name]/
https://giorgosk.github.io/hugo-quick/
## Deployment of Project Pages From Your gh-pages branch
This setup utilizes the automatic deployment to github pages by pushing to the `gh-pages` branch
## Initial preparation for gh-pages Branch as described on [hugo documentation](https://gohugo.io/hosting-and-deployment/hosting-on-github/#preparations-for-gh-pages-branch)
Ignore `public` folder in `master` branch
```
echo "public" >> .gitignore
git commit -am "Ignoring public folder in master branch"
```
Initialize your `gh-pages` branch as an empty [orphan branch](https://git-scm.com/docs/git-checkout/#git-checkout---orphanltnewbranchgt)
```
# initialize branch
git checkout --orphan gh-pages
git reset --hard
# commit and puth to github
git commit --allow-empty -m "Initializing gh-pages branch"
git push origin gh-pages
# return to master
git checkout master
```
## Build and Deployment
Setup [git worktree](https://git-scm.com/docs/git-worktree) (one time setup, kept until removed)
```
git worktree add -B gh-pages public origin/gh-pages
```
Clean public directory (optional)
```
rm -rf public
```
build the site (publishDir = "public" assumed)
```
hugo
```
Start server and make sure all works by visiting the url created
```
hugo serve
```
Commit to `gh-pages` branch
```
cd public && git add --all && git commit -m "Publishing to gh-pages" && cd ..
```
Push to github
```
git push origin gh-pages
```
Github will see the `gh-pages` branch has changed and will automatically deploy the new version of the site