DevOps & cloud · Tool integration
netlify-cli
/netlify-cli
使用 Netlify CLI 完成安装、认证、站点关联、本地开发、环境变量管理与部署。
- Author
- EthanYoQ ↗
- Repository
- Skill-hub ↗
- Licence
- MIT
- Last repository change
- 18.10.2026
Assessment and security
96/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
- Files in this package
- 7
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 3
Deprecation
No signals detected. Repository changed on 18.10.2026, without references to retired models or APIs.
Licence
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
使用 Netlify CLI 完成安装、认证、站点关联、本地开发、环境变量管理与部署。
Original author description
使用 Netlify CLI 完成安装、认证、站点关联、本地开发、环境变量管理与部署。
How it works
- Installation
- Authentication
- Linking a Site
- Deploying
- Local Development
- Environment Variables
- Useful Commands
Original SKILL.md headings · 148 lines, 555 words
SKILL.md preview
---
name: netlify-cli
description: 使用 Netlify CLI 完成安装、认证、站点关联、本地开发、环境变量管理与部署。
---
# Netlify CLI and Deployment
## Installation
```bash
npm install -g netlify-cli # Global (for local dev)
npm install netlify-cli -D # Local (for CI)
```
Requires Node.js 18.14.0+.
## Authentication
```bash
netlify login # Opens browser for OAuth
netlify status # Check auth + linked site status
```
For CI, set `NETLIFY_AUTH_TOKEN` environment variable instead.
## Linking a Site
Check if already linked with `netlify status`. If not:
```bash
# Interactive
netlify link
# By Git remote (if using Git)
netlify link --git-remote-url https://github.com/org/repo
# Create new site
netlify init # With Git CI/CD setup
netlify init --manual # Without Git CI/CD
```
Site ID is stored in `.netlify/state.json`. Add `.netlify` to `.gitignore`.
## Deploying
### Git-Based Deploys (Continuous Deployment)
Set up with `netlify init`. Automatic deploys trigger on push/PR:
- Push to production branch → production deploy
- Open PR → deploy preview with unique URL
- Push to other branches → branch deploy
Build runs on Netlify's servers. Configure build settings in `netlify.toml`.
### Manual / Local Deploys (No Git Required)
Build locally, then upload:
```bash
netlify deploy # Draft deploy (preview URL)
netlify deploy --prod # Production deploy
netlify deploy --dir=dist # Specify output directory
```
This works without Git — useful for prototypes, local-only projects, or CI pipelines.
## Local Development
### Option 1: netlify dev
```bash
netlify dev
```
Wraps your framework's dev server and provides:
- Environment variable injection
- Functions and edge functions
- Redirects and headers processing
### Option 2: Netlify Vite Plugin (Vite-based projects)
For projects using Vite (React SPA, TanStack Start, SvelteKit, Remix), the Vite plugin provides Netlify platform primitives directly in the framework's dev server:
```bash
npm install @netlify/vite-plugin
```
```typescript
// vite.config.ts
import netlify from "@netlify/vite-plugin";
export default defineConfig({ plugins: [netlify()] });
```
Then run your normal dev command (`npm run dev`) — no `netlify dev` wrapper needed. This gives you access to Blobs, DB, Functions, and environment variables during development.
See the **netlify-frameworks** skill for framework-specific local dev guidance.
## Environment Variables
### CLI Management
```bash
# Set
netlify env:set API_KEY "value"
netlify env:set API_KEY "value" --secret # Hidden from logs
netlify env:set API_KEY "value" --context production # Context-specific
# Get
netlify env:get API_KEY
# List
netlify env:list
netlify env:list --plain > .env # Export to file
# Import from file
netlify env:import .env
# Delete
netlify env:unset API_KEY
```
### Context Scoping
Variables can be scoped to deploy contexts:
```bash
netlify env:set API_URL "https://api.prod.com" --context production
netlify env:set API_URL "https://api.staging.com" --context deploy-preview
netlify env:set DEBUG "true" --context branch:feature-x
```
### Accessing in Code
- **Server-side (Functions)**: Use `Netlify.env.get("VAR")` (preferred) or `process.env.VAR`
- **Client-side (Vite)**: Only `VITE_`-prefixed vars via `import.meta.env.VITE_VAR`
- **Client-side (Astro)**: Only `PUBLIC_`-prefixed vars via `import.meta.env.PUBLIC_VAR`
**Never use `VITE_` or `PUBLIC_` prefix for secrets** — these are exposed to the browser.
## Useful Commands
| Command | Description |
|---|---|
| `netlify status` | Auth and site link status |
| `netlify dev` | Start local dev server |
| `netlify build` | Run build locally (mimics Netlify environment) |
| `netlify deploy` | Draft deploy |
| `netlify deploy --prod` | Production deploy |
| `netlify dev:exec <cmd>` | Run command with Netlify environment loaded |
| `netlify env:list` | List environment variables |
| `netlify clone org/repo` | Clone, link, and set up in one step |
Files in this package (7)
- CHANGELOG.md 1 KB
- README.md 2 KB
- SKILL.md 4 KB
- assets/.gitkeep 1 KB
- docs/beginner-guide.pdf 393 KB
- docs/full-guide.pdf 659 KB
- examples/.gitkeep 1 KB
Versions
The database has no other skills named netlify-cli.
Identical content appears in 1 other GitHub folders. We show one copy with the highest score.
Database snapshot: 13.11.2026 · package version e7e85b7ba6a8 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100netlify-deploy
Deploy web projects to Netlify using the Netlify CLI (`npx netlify`). Use when the user asks to deploy, host, publish, or link a site/repo on Netlify, including preview and production deploys. - 100netlify-deploy
Deploy web projects to Netlify using the Netlify CLI (`npx netlify`). Use when the user asks to deploy, host, publish, or link a site/repo on Netlify, including preview and production deploys. - 86devops/deploy-netlify
Netlify 部署方法论,使用 netlify CLI 部署前端应用、静态站点和 Serverless Functions - 95netlify-deploy
Deploy web projects to Netlify using the Netlify CLI (`npx netlify`). Use when the user asks to deploy, host, publish, or link a site/repo on Netlify, including preview and production deploys. - 100netlify-deploy
Deploy web projects to Netlify with the Netlify CLI. Use for authentication, site linking, preview deploys, production deploys, and post-deploy verification. - 100openai-netlify-deploy
Deploy web projects to Netlify using the Netlify CLI (`npx netlify`). Use when the user asks to deploy, host, publish, or link a site/repo on Netlify, including preview and production deploys. Originally from OpenAI's curated skills catalog.