1 | # Netlify CLI
|
2 |
|
3 | The Netlify CLI tools lets you create, deploy, and delete new sites straight from your terminal.
|
4 |
|
5 | This CLI utility is deprecated in favor of [netlifyctl](https://github.com/netlify/netlifyctl) which is the currently maintained CLI utility.
|
6 |
|
7 | ## Installation
|
8 |
|
9 | To install the CLI tools:
|
10 |
|
11 | ```bash
|
12 | npm install netlify-cli -g
|
13 | ```
|
14 |
|
15 | ## Usage
|
16 |
|
17 | Deploy a front-end project that lives in `my-project` and builds to `dist` directory:
|
18 |
|
19 | ```bash
|
20 | cd my-project/
|
21 | netlify deploy dist
|
22 | ```
|
23 |
|
24 | ## Configuration and Authentication
|
25 |
|
26 | The first time you use the netlify cli command you'll be asked to authenticate.
|
27 |
|
28 | Your access token is stored in `~/.netlify/config`.
|
29 |
|
30 | Netlify also stores a local `.netlify` file in the folder where you run `netlify deploy` from where the `site_id` is stored.
|
31 |
|
32 | ## Environments
|
33 |
|
34 | You can easily setup different environments like `staging` or `production`. Just use the `-e` flag:
|
35 |
|
36 | ```bash
|
37 | netlify deploy dist -e production
|
38 | ```
|
39 |
|
40 | Netlify creates different sites with each their own URL for each of your environments and keeps track of them in the `.netlify` config file.
|
41 |
|
42 | ## Caveats
|
43 |
|
44 | - netlify-cli is known to hang with an "ECONNRESET" error (parsed as JSON, it will look odd) when used from many CI environments. This is a known issue that is only fixed in our alternate and current CLI: https://github.com/netlify/netlifyctl
|
45 |
|
46 | - netlify-cli is known to hang when used with Node.js version 8.1.0. Version 8.1.2 works well
|