con un clic
gitee-to-github-migration
将项目从 Gitee 迁移到 GitHub 的完整指南,包含错误案例和最佳实践
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
将项目从 Gitee 迁移到 GitHub 的完整指南,包含错误案例和最佳实践
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
当用户希望整理需求、明确目的、描述问题,或要求"生成文档"、"整理意图"、"明确现象"时触发。用于通过多轮对话收集和整理需求,不执行任何代码修改。
当用户说 "boot work-flow"、"初始化 work-flow"、"为这个仓库创建 work-flow skill"、"创建 <仓库名>-work-flow" 时触发。这是一个元skill:自动检测 git 仓库名 → 在项目本地创建 <repo>-work-flow skill → 仅写入项目启动方法和启动信息作为最小骨架 → 标注后续通过 /key_board_3 添加 references 增强。
清理git嵌套仓库,保持仓库隔离性,让 git add . 干净无污染。 适用于 .claude/repo/ 或其他包含克隆仓库的目录。 当用户提到"清理git"、"处理嵌套仓库"、"git隔离"、"保持干净"、 "部分跟踪"、"白名单子目录"、"忽略但保留子目录"、"gitignore 否定规则"、 "忽略 .tool/"、"工具目录不入库"时触发。
当用户要求"总结成skill"、"保存对话为skill"、"提取提示词"、"做成技能"时触发。这是元技能模板,用于指导创建其他技能,而非被创建的技能本身。
当用户要求"拆分到references"、"给skill加ref引导"、"把xx沉淀为reference"、"优化skill结构"、"重构skill"、"skill膨胀了"、"合并skill"、或要求"探索/扫描现有skill看哪些可合并"时触发。本 skill 专用于按主题把已有 skill 组织成渐进式指导文档——主 SKILL.md 承担主干主题、references/ 承担特化专项的特化指导,整个 skill 包高内聚、单文档承担一个主题;长度只是边缘参考。不创建新 skill、不改变前置 skill (key_board / key_board_2) 的职责。探索模式详见 [[场景E-合并审计]]。
阅读任意代码库目录(不限语言/框架),分析模块与代码结构,生成防腐蚀规范 SKILL.md、更新已有 skill 使其与代码库一致、或在使用 skill 后反思同步项目经验。覆盖"创建"、"同步"、"反思"三个场景。不生成孤儿文档。
| name | gitee-to-github-migration |
| description | 将项目从 Gitee 迁移到 GitHub 的完整指南,包含错误案例和最佳实践 |
| type | reference |
# 1. 检查 GitHub CLI 登录状态
gh auth status
# 2. 查看当前远程
git remote -v
# 3. 删除所有远程(注意拼写 orgin 和 origin 都要删)
git remote remove origin
git remote remove orgin
# 4. 创建 GitHub 仓库并推送
gh repo create <repo-name> --public --source=. --push
gh auth status
预期输出包含:
Logged in to github.comActive account: trueGit operations protocol: ssh如果未登录:gh auth login
git remote -v
常见情况:
| 情况 | 命令 |
|---|---|
| 正常 origin | git remote remove origin |
| 拼写错误 orgin | git remote remove orgin |
| 两个都存在 | git remote remove origin && git remote remove orgin |
| 自定义名称 | git remote remove <name> |
重要:Gitee 远程可能拼写错误为 orgin(少一个 i),必须单独检查并删除。
# 删除所有远程
git remote remove origin
git remote remove orgin
# 确认已删除
git remote -v
# 应该无输出
方式 A:一条命令完成(推荐)
gh repo create <repo-name> --public --source=. --push
方式 B:分步操作
# 创建空仓库
gh repo create <repo-name> --public
# 添加远程
git remote add origin git@github.com:<username>/<repo-name>.git
# 推送
git push -u origin main
git remote -v
# 应显示: origin git@github.com:<username>/<repo-name>.git (fetch/push)
git status
# 应显示: Your branch is up to date with 'origin/main'.
原因:GitHub 上已存在同名仓库且有初始提交
错误输出:
! [remote rejected] main -> main (cannot lock ref 'refs/heads/main': reference already exists)
error: failed to push some refs to 'github.com:<username>/<repo-name>.git'
解决方案:
git push -u origin main --force
⚠️ 警告:强制推送会覆盖 GitHub 上现有内容,确认仓库内容可以覆盖后再执行。
原因:Gitee 远程被命名为 orgin(缺少字母 i)
现象:git remote -v 显示 orgin,执行 git remote remove origin 无效
解决方案:
git remote remove orgin
原因:同时存在 origin (GitHub) 和 orgin (Gitee)
现象:git remote -v 显示两个远程
解决方案:
git remote remove origin
git remote remove orgin
git remote add origin git@github.com:<username>/<repo-name>.git
原因:用 --source=. --push 但仓库已存在
解决方案:改用分步操作
gh repo create <repo-name> --public
git remote add origin git@github.com:<username>/<repo-name>.git
git push -u origin main
| 变量 | 替换为 |
|---|---|
<repo-name> | 仓库名,如 br_ct |
<username> | GitHub 用户名,如 ZHLX2005 |
如果需要保留 Gitee 作为备份,只添加 GitHub 作为额外远程:
# 保留现有远程,添加 GitHub
git remote add github git@github.com:<username>/<repo-name>.git
# 推送到两个远程
git push -u github main
git push -u origin main # Gitee
gh auth status 显示已登录git remote -v 只显示 GitHub,不显示 Giteegit remote -v 无拼写错误残留(orgin)gh repo view <repo-name> 能看到仓库git status 显示 "up to date with 'origin/main'"# 登录状态
gh auth status
# 登录
gh auth login
# 创建仓库
gh repo create <name> [flags]
# 查看仓库
gh repo view <name>
# 列出用户仓库
gh repo list <username> --limit 10
常用 flags:
--public 公开仓库--private 私有仓库--source=. 使用当前目录--push 推送现有代码