I’ve got a Vue application I’m deploying to Netlify via the CLI. I did not use netlify init because the CLI noticed it was part of a GitHub repo and forced me to associate the site with the repo. In my case, the site I wanted to deploy was a subdirectory of the GitHub repo and I didn’t want the association. I was fine w/o CI.

So I used netlify deploy and selected to make a new site. That worked, but my site didn’t deploy right because I didn’t specify a build command.

In the Netlify admin, I noticed I was not allowed to specify a build command. Maybe it’s only allowed when CI is used? So I decided to make a netlify.toml file instead and just specify it there.

I ran netlify deploy again and it didn’t know I had already connected it to a site. I’m not sure why the first time I ran it didn’t work. I mean it did make a site and all but nothing was configured right locally. Anyway I told the CLI to connect to an existing site. I picked the one I created moments earlier and then got this output:

This folder isn't linked to a site yet
? What would you like to do? Link this directory to an existing site git directory located in /mnt/c/projects/vue-demos netlify link will connect a site in app.netlify.com to this folder
? How do you want to link this folder to a site? Choose from a list of your sites ? What is the name of the site? nps-gallery Directory Linked Admin url: https://app.netlify.com/sites/nps-gallery Site url: https://nps-gallery.netlify.com Site id saved to /mnt/c/projects/vue-demos/nps_gallery/.netlify/state.json You can now run other `netlify` cli commands in this directory
Please provide a deploy path relative to:
/mnt/c/projects/vue-demos/nps_gallery
? deploy path /mnt/c/projects/vue-demos/nps_gallery Deploy path: /mnt/c/projects/vue-demos/nps_gallery Configuration path: /mnt/c/projects/vue-demos/nps_gallery/netlify.toml Deploying to live site URL...
✔ Finished hashing 18 files 🚶 CDN diffing files... › Warning: › {} › Error: Missing required param site_id
at ~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/node_modules/netlify/src/open-api/index.js:34:15 at Array.forEach (<anonymous>)
at NetlifyAPI.createSiteDeploy (~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/node_modules/netlify/src/open-api/index.js:28:43)
at module.exports (~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/node_modules/netlify/src/deploy/index.js:77:26)
at async NetlifyAPI.deploy (~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/node_modules/netlify/src/index.js:108:12)
at async DeployCommand.run (~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/src/commands/deploy.js:144:17) at async DeployCommand._run (~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/node_modules/@oclif/command/lib/command.js:44:20)
at async Config.runCommand (~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/node_modules/@oclif/config/lib/config.js:151:9)
at async Main.run (~/.nvm/versions/node/v12.9.0/lib/node_modules/netlify-cli/node_modules/@oclif/command/lib/main.js:21:9)

The netlify deploy command is doing a manual deploy (a deploy without a build). This is the CLI equivalent of a “Drag & Drop” deploy done in the web UI.

For both netlify deploy and “Drag & Drop”, the files of the site are deployed “as is”. There is no build process with either method.

If using this command, the build should occur locally and then the command is used to manually deploy the files which were built there.

This means the CLI tool is also convenient for enabling deploys for builds which occur on other CD/CI systems. You can build anywhere outside of Netlify and still use the CLI tool to deploy the exact files from that build to Netlify.

If you are looking for a solution to use the netlify.toml in a subdirectory of a repo to build only a subdirectory as a Netlify site, that cannot be done. At this time, netlify.toml is always read from the base of the repo (which is not the same as the “base directory” setting in our configuration).

You can link one repo to more than one site and designate the build and publish directories in the Netlify UI. This can use useful when you have a mono-repo and want to build separate sites from subdirectories of that repo. No netlify.toml can exist in the base of the repo in this use case. If netlify.toml does exist, it will override the UI settings and prevent the per-site settings from taking effect.

Finally, the command netlify deploy will not update the published version of a site (it only makes a deploy preview). Use the --prod option (netlify deploy --prod) to deploy a production version of the site which will update the published version of the site.