git-fork-clone
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGit Fork & Clone
Git Fork & Clone
Fork 别人的 GitHub 仓库并 clone 到本地,自动配置 official remote。
Fork someone else's GitHub repo and clone it locally, with automatic setup of the official remote.
触发条件
Trigger Conditions
当用户要求 fork 别人的仓库并 clone 到本地时使用此 skill。
Use this skill when the user requests to fork someone else's repo and clone it locally.
输入
Input
用户需要提供目标仓库,格式为 。
owner/repoThe user needs to provide the target repo in the format .
owner/repo执行步骤
Execution Steps
- Fork 仓库:使用 将仓库 fork 到
gh repo fork <owner/repo> --clone=false账号下。zc277584121 - Clone 仓库:使用 将 fork 后的仓库 clone 到本地。
gh repo clone zc277584121/<repo> - 进入项目目录:。
cd <repo> - 添加 official remote:,用于跟踪上游仓库。
git remote add official https://github.com/<original-owner>/<repo>.git - 验证 remote 配置:,确认 origin 指向自己的 fork,official 指向原始仓库。
git remote -v
- Fork the Repo: Use to fork the repo to the
gh repo fork <owner/repo> --clone=falseaccount.zc277584121 - Clone the Repo: Use to clone the forked repo locally.
gh repo clone zc277584121/<repo> - Navigate to the Project Directory: .
cd <repo> - Add Official Remote: to track the upstream repo.
git remote add official https://github.com/<original-owner>/<repo>.git - Verify Remote Configuration: to confirm that
git remote -vpoints to your fork andoriginpoints to the original repo.official
注意事项
Notes
- 如果 fork 已存在,会自动跳过 fork 步骤。
gh repo fork - 始终使用 作为上游 remote 名称(而非
official),以保持一致性。upstream - Clone 完成后向用户报告 remote 配置结果。
- If the fork already exists, will automatically skip the forking step.
gh repo fork - Always use as the upstream remote name (instead of
official) to maintain consistency.upstream - Report the remote configuration result to the user after cloning is completed.