fix 02-cfg-cli content (was corrupted), add prereq to 04-git-identity -- 小糯
This commit is contained in:
parent
c39ceebfe4
commit
eb10cc559a
@ -1 +1,64 @@
|
|||||||
File unchanged since last read. The content from the earlier read_file result in this conversation is still current — refer to that instead of re-reading.
|
# 02. cfg CLI (配置管理)
|
||||||
|
|
||||||
|
## 检查
|
||||||
|
|
||||||
|
```bash
|
||||||
|
which cfg
|
||||||
|
cfg list 2>/dev/null | head -5
|
||||||
|
cfg get GITEA_TOKEN
|
||||||
|
```
|
||||||
|
|
||||||
|
✅ 达标:`cfg` 可用,能列出配置项,`GITEA_TOKEN` 有值
|
||||||
|
|
||||||
|
## 前置
|
||||||
|
|
||||||
|
- 已完成 01 (SSH 密钥对)
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
### 1. 安装 cfg
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install -g @shazhou/cfg
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 配置 Token
|
||||||
|
|
||||||
|
找主人 (沙洲) 要一个 cfg auth token。拿到后:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cfg token 你拿到的TOKEN
|
||||||
|
```
|
||||||
|
|
||||||
|
Token 会存到 `~/.config/cfg/token`。
|
||||||
|
|
||||||
|
### 3. 同步配置
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cfg sync
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. 注入环境变量
|
||||||
|
|
||||||
|
把 cfg env 加入 `.profile`,这样每次登录自动注入:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
echo 'eval "$(cfg env)"' >> ~/.profile
|
||||||
|
eval "$(cfg env)"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 重要规则
|
||||||
|
|
||||||
|
- `cfg env` 导出所有**非 no-env** 的配置为环境变量
|
||||||
|
- `cfg set KEY VALUE` 写入 **personal scope**(只有你自己能看到)
|
||||||
|
- `cfg set --shared KEY VALUE` 写入 **shared scope**(所有人可见,需要 admin 权限)
|
||||||
|
- `--secret` 标记敏感值,`--no-env` 标记不需要导出为环境变量的值
|
||||||
|
- GITEA_TOKEN 是每个 agent 自己的,不要共用
|
||||||
|
|
||||||
|
## 验证
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cfg list
|
||||||
|
cfg get GITEA_TOKEN
|
||||||
|
# 应该返回你自己的 token
|
||||||
|
```
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
# 04. Git 身份配置
|
# 04. Git 身份配置
|
||||||
|
|
||||||
|
## 前置
|
||||||
|
|
||||||
|
- 已完成 03 (shazhou.work 邮箱) — 需要邮箱地址配 user.email
|
||||||
|
|
||||||
## 检查
|
## 检查
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user