sin601/claude-code
0
1# 部署指南2 3## 步骤 1: 创建 GitHub 仓库4 51. 登录 GitHub62. 点击右上角 "+" > "New repository"73. 填写仓库信息:8 - Repository name: `claude-code-hf-space`9 - Description: `Claude Code on Hugging Face Spaces`10 - 选择 Private (推荐)114. 点击 "Create repository"12 13## 步骤 2: 推送代码14 15```bash16cd /home/z/my-project/download/claude-code-hf-space17 18# 使用你的 GitHub 用户名19GITHUB_USER="your-username"20 21# 添加远程仓库22git remote set-url origin https://github.com/${GITHUB_USER}/claude-code-hf-space.git23 24# 推送 (需要 GitHub Personal Access Token)25git push -u origin main26```27 28## 步骤 3: 创建 Hugging Face Space29 301. 登录 Hugging Face312. 点击 "Create new Space"323. 填写信息:33 - Space name: `claude-code`34 - SDK: 选择 "Docker"35 - Hardware: 选择 "CPU basic" (免费)364. 在 "GitHub repository" 选项中关联你的 GitHub 仓库375. 点击 "Create Space"38 39## 步骤 4: 配置 Secrets40 41在 HF Space 的 Settings > Variables and secrets 中添加:42 43```44ANTHROPIC_API_KEY = sk-ant-xxxxx45```46 47可选:48```49GIT_REPO_URL = https://github.com/your-username/your-repo.git50GIT_TOKEN = ghp_xxxxx51```52 53## 步骤 5: 等待构建54 55HF Space 会自动构建 Docker 镜像,大约需要 5-10 分钟。56 57## 步骤 6: 使用58 59构建完成后,点击 "App" 标签页打开 Web Terminal,输入 `claude` 启动。60 