🔑 SSH 密钥配置

为什么需要 SSH 密钥?

使用 SSH 方式推送代码无需每次输入密码,更安全便捷。

1. 生成 SSH 密钥

ssh-keygen -t ed25519 -C "你的邮箱@example.com"

按提示:保存位置直接回车(默认 ~/.ssh/id_ed25519),密码可选。

2. 复制公钥

macOS / Linux

cat ~/.ssh/id_ed25519.pub

Windows PowerShell

Get-Content ~/.ssh/id_ed25519.pub

公钥格式示例:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI... 邮箱

3. 添加到 TokenAI Git

  1. 登录 → 右上角头像 → 设置
  2. 左侧菜单 → SSH/GPG 密钥
  3. 添加密钥 → 粘贴公钥 → 保存

4. 测试连接

ssh -T git@git.tokenai.biz

成功:Hi there, 用户名! You've successfully authenticated...

5. 使用 SSH 克隆

git clone git@git.tokenai.biz:用户名/仓库名.git