Deploy HTML from the Terminal: Publish and Update a Real Project
Publish the example project from your terminal
This walkthrough takes a local folder from first deployment to an update at the same public address. You need Node.js, npm and an htmlhost account. Prefer clicking through the editor? Use the browser hosting walkthrough.
1. Download a project you can inspect
Download the example website ZIP and extract it. Open the extracted folder containing index.html in your terminal. It includes an About page, a nested Consultation page, a stylesheet and an SVG image:
index.html
about.html
services/consultation.html
assets/styles.css
assets/mark.svg
Open the working example to see what the files should render. The example pages deliberately include a noindex tag. Keep it for this test, or remove it from each HTML file when adapting the example for a site you want in search.
2. Install the CLI and approve sign-in
npm install -g htmlhost-cli
htmlhost --version
htmlhost login
Sign in in the browser, check the displayed code and approve the request you started. Return to the terminal to finish login. If the browser does not open, use the address printed by the CLI. Keep the saved authentication token private; do not copy it into project files or screenshots.
3. Deploy the complete folder
cd path/to/hosting-starter
htmlhost deploy
Replace the example path with your extracted folder. With no file argument, htmlhost deploy uploads the current directory; htmlhost deploy . is equivalent. Review the file list and confirm the deployment and any publication prompt. Wait for the command to report success and print your actual live URL.
Directory deployment includes HTML, CSS, JavaScript and binary assets. No --pages flag is needed. Use htmlhost deploy index.html only when you intend to deploy that single document. Keep private files and API secrets out of the project.
Open the printed HTTPS address, then test /about and /services/consultation directly in new tabs. Check the stylesheet, image and navigation on each page. For a framework project, build its static export first and deploy the output directory; uploading source files does not run a backend or compiler.
4. Make an edit and update the same address
The first successful deployment creates a local .htmlhost file linking this directory to the site. Keep it. Open index.html in your text editor, change a visible sentence and save, then run:
htmlhost deploy
Check that the confirmation names the existing site, approve the update and wait for success. Reload the same public URL and verify your new sentence. The address stays the same. Only use htmlhost deploy --new when you want a separate site; on Free, that consumes another lifetime site-creation slot.
5. Handle browser edits before deploying again
If someone edited the project in htmlhost, the CLI can warn that remote changes are newer than your local copy. Cancel and commit or back up your local work before pulling. Inspect the proposed download first:
htmlhost pull --dry-run
After reviewing it, htmlhost pull downloads the remote files with confirmation. It can overwrite local files; it does not merge their contents. Reconcile the downloaded files with your backup before deploying. See the pull walkthrough and how the pre-deploy sync check works for the full process.
Saved drafts and published files are different
htmlhost deploy --draft saves privately. Publishing an unpublished project requires separate confirmation. For deliberate non-interactive publication, --publish supplies that confirmation; do not use it in automation without the owner's approval.
By default, pull retrieves the working copy, including a saved draft when one exists. To inspect only the last published files, use htmlhost pull --published --dry-run before deciding whether to download them with htmlhost pull --published. Pulling a draft does not itself publish it. The CLI draft reference covers these choices.
When a step fails
- Command not found: confirm Node.js and npm are installed, reopen the terminal and check that npm's executable directory is on PATH.
- Sign-in required: run htmlhost login and complete the browser approval.
- Wrong files listed: cancel and change to the folder containing the intended index.html. Deploy built output for a framework.
- Missing CSS or images: include the referenced files and check relative paths and filename case. A file:// address points to your own computer. See nested pages and asset paths.
- Unexpected new site: check that you are in the linked directory and have its .htmlhost file. Do not add --new to fix an update.
- Site or storage limit: review current plan limits. Updating a linked site differs from creating another one.
Before sharing, test the live pages at desktop and phone widths. Test form delivery separately; a visible form or success message does not prove a submission arrived. Keep a local backup and use the CLI reference for other commands.
Ready to try it yourself?
Import your HTML, check the preview, then publish a link you can share and update.
Start hosting