Original post is here: eklausmeier.goip.de
Many people associate netlify.com with its integration to GitHub, GitLab or Bitbucket. But you can just deploy your local files to Netlify as well.
Install netlify
command via npm install netlify-cli
. cd
to the directory where you locate your static content. Login to Netlify site via
1netlify login
This will either directly open a browser, where you confirm the login, or enter your credentials. If the browser is not opened, then enter the URL given on console. Once you are logged in and have configured your domain name in the Netlify administration menu, you can deploy. For this run below command
1netlify deploy --prod -d .
Netlify has the notion of two environments: preview and production. You can skip the preview environment and deploy directly to production.
The netlify command offers the following options.
1$ netlify -h
2Netlify command line tool
3
4VERSION
5 netlify-cli/2.48.0 linux-x64 node-v13.13.0
6
7USAGE
8 $ netlify [COMMAND]
9
10COMMANDS
11 addons (Beta) Manage Netlify Add-ons
12 api Run any Netlify API method
13 build (Beta) Build on your local machine
14 deploy Create a new deploy from the contents of a folder
15 dev Local dev server
16 functions Manage netlify functions
17 help display help for netlify
18 init Configure continuous deployment for a new or existing site
19 link Link a local repo or project folder to an existing site on Netlify
20 login Login to your Netlify account
21 open Open settings for the site linked to the current folder
22 plugins list installed plugins
23 sites Handle various site operations
24 status Print status information
25 switch Switch your active Netlify account
26 unlink Unlink a local folder from a Netlify site
27 watch Watch for site deploy to finish
The netlify
script stores your credentials in $HOME/.netlify/config.json
.
The netlify deploy --prod .
command does not honor symbolic links. For example, symlinked images will not get uploaded.
My static site on netlify.app is here: klm.netlify.app.
Added 27-Oct-2024: Latest twist in command line trickery:
1netlify deploy --prod -s klm .