安装
安装、认证和配置 sh0 CLI。
安装脚本
推荐的安装方式。脚本检测您的操作系统和架构,从 GitHub Releases 下载正确的二进制文件,并放置在 /usr/local/bin/sh0。
curl -fsSL https://get.sh0.dev | bash安装后验证:
sh0 --version手动下载
直接从 下载页面 或 GitHub Releases 下载二进制文件:
curl -fsSLO https://github.com/zerosuite-inc/sh0/releases/latest/download/sh0-linux-x64.tar.gz
curl -fsSLO https://github.com/zerosuite-inc/sh0/releases/latest/download/checksums.txt
sha256sum --ignore-missing -c checksums.txt
tar -xzf sh0-linux-x64.tar.gz
sudo install -m 0755 sh0 /usr/local/bin/sh0可用的发布压缩包(每个都包含 sh0 二进制文件):
sh0-linux-x64.tar.gzsh0-linux-arm64.tar.gzsh0-darwin-x64.tar.gzsh0-darwin-arm64.tar.gz
支持的平台
| 操作系统 | 架构 | 状态 |
|---|---|---|
| Linux | x86_64 | 支持 |
| Linux | aarch64 (ARM64) | 支持 |
| macOS | x86_64 (Intel) | 支持 |
| macOS | aarch64 (Apple Silicon) | 支持 |
认证
CLI 支持两种认证方式。本地开发使用交互式登录,CI/CD 使用环境变量。
sh0 login
交互式登录提示输入服务器 URL、邮箱和密码。会话令牌存储在 ~/.sh0/config.toml。
sh0 login --url https://panel.example.com如果省略 --url,CLI 使用现有配置中的 URL 或默认为 http://localhost:9000。
环境变量
对于 CI/CD 和自动化,设置这些环境变量。它们优先于 config.toml。
export SH0_API_URL="https://panel.example.com"
export SH0_API_TOKEN="sh0_tok_..." Tip
在 GitHub Actions 中,将它们存储为仓库密钥并在工作流文件中引用。
配置文件
CLI 将配置存储在 ~/.sh0/config.toml。此文件由 sh0 login 自动创建。
api_url = "https://panel.example.com"
token = "sh0_tok_..."
default_app = "myapi"
output = "table" # or "json"除 api_url 和 token 外,所有字段均可选。default_app 允许您在 sh0 logs 等命令中省略应用名。
验证安装
安装和认证后,验证一切正常:
sh0 whoami预期输出:
Server: https://panel.example.com
User: [email protected]
Role: admin Warning
配置文件包含您的认证令牌。它以
600 权限创建(仅所有者可读写)。不要将其提交到版本控制。