Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I mean, if you're doing a static site you can also use github pages with a simple push command. Is there some difference between surge and doing this that I'm not seeing?


If you are properly preparing your assets for web distribution you really don't want those files in a git repo. it messes up your commit history and doesn't provide much value. I think gh-pages is fundamentally broken for this reason. IMHO its best to keep your source files in a git repo and publish your compiled assets to surge.


https://github.com/edgecase/middleman-gh-pages solves this problem by letting you do all your work on the master branch, then your build script compiles all your assets and commits them to the gh-pages branch, so it doesn't pollute your Git history.


It's a common work-flow to have your stable/prod/dist/build in a separate branch, just like gh-pages is.


I used to use GitHub Pages, but you can't have a custom domain that has SSL, so I switched to Surge like six months ago, and it works great. To be honest, though, if GitHub adds custom domains with SSL to pages, I'll probably switch back.


Have you considered Gitlab, which does advertise custom domains for which you can upload your own SSL certs? Even at the free plan level. I would switch to it if not for the fact that my site isn't dealing with any kind of sensitive stuff so I figured Github Pages with Cloudflare's SSL was enough, although I'm aware its not end-to-end.


I couldn't get CloudFlare's SSL to work with GitHub Pages when I tried it because of some DNS issues. Do you have that working?


I think your sites need to be "on" cloudflare (i.e., the cloud icon in the DNS settings page needs to be orange and not grey) for other features like SSL and Page Rules to work. Specifically for Github Pages I configured both my apex custom domain and my www subdomain to point to myusername.github.io. Cloudflare will automatically follow myusername.github.io and return the origin IP when requests are made to the apex custom domain, something they call CNAME flattening, and similar to the ALIAS and ANAME records offered by other DNS providers. Plus I set SSL as "Full" but NOT "Full(Strict)" as the latter won't work with Github Pages' servers. There are some anecdotal reports I've read saying that for some Github Pages sites even Full SSL doesn't work, so if that's the case you can try Flexible SSL which should work in all cases. And of course as the other responder said, don't forget to redirect all your http requests to https using a Page Rule along the lines of http://*mydomain.com/* --> 301 redirect --> https://[www].mydomain.com/$2

Hope that helps.


I do. I just enabled CloudFlare's SSL, added a redirect rule from unsecured http to SSL in CF (there is a template I think) and adjusted the base URL in the YAML file of the repo accordingly. I don't believe I did anything else.


`(ノಥ,_」ಥ)ノ彡┻━┻`


The deploy process is much easier for me to manage on GitHub Pages, because I can just do "rake publish" and middleman-gh-pages deploys the site. Neither I nor my collaborators have to deal with the details of deploying. Surge makes you remember to call the surge command with the proper arguments and have collaborators also have surge accounts set up properly.

Maybe there's a way to have a GitHub webhook automatically trigger a deploy to Surge? That would probably solve this issue for me. Though GitHub Pages is still easier.


You could set up a Travis CI job to build and deploy the site on every push.

https://surge.sh/help/integrating-with-travis-ci




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: