I love how easy it is to set up automatic hosting of a website with Netlify.
Sign in to Netlify and click the "New site from Git" button. Select your git repository, either GitHub, GitLab or Bitbucket, and give access to the wanted repository.
If you have build commands, such as npm run build
, you can enter those. Commands can be chained with &&.
Enter the path of the directory to publish. The directory containing the index.html file
Now hit Deploy site and you are done. New pushes to your git repository will automatically be published to your website. You can change your subdomain in "Site settings" and "Change site name".
Terminal commands you don't need, but might find useful:
# Install netlify cli globally
npm install netlify-cli -g
# Serving your site on localhost
netlify dev
# Connect folder to Netlify project
netlify init
# Serve your local development online ang get a url you can distribute
netlify dev --live
# Manually deploy
netlify deploy --prod
That's all, thank you for reading π
This article is part of Hosting a Website series, I usually choose Firebase when I want to deploy manually or are using other Firebase products and Netlify if I want CD (continuous delivery). Though both manually and CD is possible to achieve with both of them.
Top comments (7)
Great article! It is crazy how easy it is to host a site on Netlify, I host my blog on there and it makes it very easy! Thanks for the article!
I tried it a couple of weeks back and I'm still amazed about how easy and wonderful it works.
What a service.
Can you tell your experience about hosting it on Netlify?
I mean their support, their pricing, their services?
My experience has been very pleasant, everything has just worked right away. So I have never had the need for any support. They have a very generous free price tier, so you might get everything you need for free. Usually you would upgrade if you need other features such as analytics or the possibility to add multiple team members and owners.
But I have only used Netlify for my own small projects. So I have not used other services from Netlify or tested how it scales.
I'm hosting 2 Gatsby sites and one Angular app on Netlify for free. Super easy to use, I found out about it on the Syntax.fm podcast and I love it
Netlify is great. A good alternative is Zeit. Both wonderful services with a free tier.
Cool, thanks! I hadn't heard about Zeit before, but it looks great. I will check it out :)