I followed this tutorial to deploy my Hugo blog as a post-receive
Git hook.
I make changes locally, push to my server and that triggers the post-receive
hook, which in turns runs something like:
/usr/bin/hugo -s $WORKING_DIRECTORY -d $PUBLIC_WWW
That results in the following crash:
remote: running hugo
remote: Started building sites ...
remote: panic: runtime error: slice bounds out of range
remote:
remote: goroutine 126 [running]:
remote: panic(0xa36160, 0xc42000a0c0)
remote: /usr/local/Cellar/go/1.7.1/libexec/src/runtime/panic.go:500 +0x1a1
remote: github.com/spf13/hugo/hugolib.splitUserDefinedSummaryAndContent(0xad7814, 0x8, 0xc420a14000, 0x13bd, 0x13be, 0xc42066fda0)
remote: /Users/spf13/gopath/src/github.com/spf13/hugo/hugolib/page.go:337 +0x8da
remote: github.com/spf13/hugo/hugolib.(*Page).setUserDefinedSummaryIfProvided(0xc4202e4a00, 0x0, 0x0, 0x0)
remote: /Users/spf13/gopath/src/github.com/spf13/hugo/hugolib/page.go:262 +0x66
remote: github.com/spf13/hugo/hugolib.(*Site).preparePagesForRender.func1(0xc420660101, 0x100, 0x0, 0xc420076000, 0xc42066fda0, 0xc420a1d0c0)
remote: /Users/spf13/gopath/src/github.com/spf13/hugo/hugolib/hugo_sites.go:482 +0x2dd
remote: created by github.com/spf13/hugo/hugolib.(*Site).preparePagesForRender
remote: /Users/spf13/gopath/src/github.com/spf13/hugo/hugolib/hugo_sites.go:507 +0x107
remote: A problem occurred. Reverting to backup.
If I run the same script from a SSH session in my prod server everything works just fine. The issue is not related to working directories, as the paths are all absolute. I’m using the same username for both my SSH session and the Git remote, so it shouldn’t be a permissions thing.
Do you know why this is happening? The error message is not really helpful.