Update publish_to_ghpages.sh

* Fix publish_to_ghpages.sh

* Add "git push" comment to the end of publish_to_ghpages.sh

* Remove redundant suggestion about CNAME file
This commit is contained in:
AdaKaleh 2019-06-13 15:40:26 +00:00 committed by Bjørn Erik Pedersen
parent 7c120346b1
commit ab2233c395

View File

@ -4,7 +4,7 @@ linktitle: Host on GitHub
description: Deploy Hugo as a GitHub Pages project or personal/organizational site and automate the whole process with a simple shell script.
date: 2014-03-21
publishdate: 2014-03-21
lastmod: 2017-03-30
lastmod: 2018-09-22
categories: [hosting and deployment]
keywords: [github,git,deployment,hosting]
authors: [Spencer Lyon, Gunnar Morling]
@ -193,11 +193,7 @@ To automate these steps, you can create a script with the following contents:
{{< code file="publish_to_ghpages.sh" >}}
#!/bin/sh
DIR=$(dirname "$0")
cd $DIR/..
if [[ $(git status -s) ]]
if [ "`git status -s`" ]
then
echo "The working directory is dirty. Please commit any pending changes."
exit 1;
@ -220,9 +216,12 @@ hugo
echo "Updating gh-pages branch"
cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)"
#echo "Pushing to github"
#git push --all
{{< /code >}}
This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing. Or adding `echo yourdomainname.com >> CNAME` if you set up for your gh-pages to use customize domain.
This will abort if there are pending changes in the working directory and also makes sure that all previously existing output files are removed. Adjust the script to taste, e.g. to include the final push to the remote repository if you don't need to take a look at the gh-pages branch before pushing.
### Deployment of Project Pages from Your `master` Branch