Netlify CLI Quickstart

Netlify is a service where you can deploy static sites (HTML/CSS/JS) for free. Here are steps on how to get started.

First, be sure that node.js is installed. (nvm is a good way to install node.) Create an account on Netlify.

$ node -v
v10.14.0

Then install netlify-cli:

$ npm install -g netlify-cli

If you want more privacy, turn off tracking:

$ netlify --telemetry-disable

Create a directory for your project that has a public directory inside of it. Put any files that you want to deploy to your website (the HTML, CSS, and JS) into public:

$ tree
.
β”œβ”€β”€ css
β”‚   └── main.css
β”œβ”€β”€ images
β”‚   └── kitten.gif
β”œβ”€β”€ index.html
└── js
    └── main.js

Then type this command to log in to netlify:

$ netlify login

When you’re ready to deploy, type this:

$ netlify deploy

It will give you a secret, staging URL where you can preview your site. If that looks good, type this to deploy to production:

$ netlify deploy --prod

Then go to netlify.com and configure settings for the new site. You can add a custom domain, add AWS Lambda functions, create forms, and add redirects and headers.

2 Likes