Package a finished local project into an intentional GitHub repository, create a strong README and visual preview, push it safely, configure a public GitHub Pag
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-publish-project-to-github-900dba940275 ,按照其中的说明把「publish-project-to-github」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Turn a finished local project into a clean public artifact. Treat repository creation, public visibility, and deployment as separate gates; a successful push is not proof that the public site works.
Produce the applicable items:
README.mdInspect the local project, repository state, remotes, and local instructions before writing.
Confirm or safely infer:
Creating a public repository is authorized only when the user explicitly asks for public sharing, a public URL, open source, or equivalent. Otherwise ask for visibility before creating it.
Never force-push, overwrite an existing remote, change repository visibility, or replace an existing Pages configuration without exact authorization.
Run the bundled audit from the project root:
bash /path/to/publish-project-to-github/scripts/audit_public_project.sh .
Then inspect findings rather than treating the script as a substitute for judgment.
Block publication on:
.env filesReview all external runtime URLs and generated assets. State any required network dependency in the README.
Inspect the existing license before publishing. If the user explicitly wants others to reuse or modify the project and no license exists, ask which license to add rather than inventing one. If the goal is only public viewing, a missing license does not block deployment, but report that reuse rights are not granted explicitly.
Use the existing checkout when its remote, history, and tracked files match the intended public project. Stage only the requested files.
Create a clean project directory or sibling checkout when the source workspace contains unrelated experiments, deletions, private files, or history. Copy only the intended runtime files. Do not publish an entire mixed folder for convenience.
Inspect its default branch, Pages source, README, license, and remote state before changing it. Pull or reconcile deliberately; never hide divergence with a force push.
For a static one-file experiment, prefer this minimal shape:
project-name/
├── index.html
├── README.md
├── PROMPT.md # optional
├── assets/ # optional previews or runtime assets
└── .gitignore
Write the README from the real project. Use assets/README-template.md as a starting structure, not as final copy.
Include:
For agent-built projects, optionally add official links and a portable prompt showing how to rebuild or remix the project with relevant coding agents. Verify current official URLs before publishing.
Avoid generic claims such as “cutting-edge,” “stunning,” or “production-ready.” Prefer specific craft and behavior.
Use the project's real runtime rather than opening module-based sites directly from disk.
For static sites:
python3 -m http.server 4173 --bind 127.0.0.1
Check:
390 × 844 when the project is responsive/project-name/Use the browser requested by the user or required by repository instructions. Capture the README preview from this verified runtime.
Require GitHub CLI and an authenticated session:
gh --version
gh auth status
Check name availability before creation:
gh repo view OWNER/REPOSITORY
Initialize and commit only the intended package:
git init -b main
git add -- README.md index.html .gitignore
git diff --cached --check
git commit -m "Publish PROJECT_NAME"
Add optional files explicitly rather than replacing the narrow git add with git add -A in a mixed tree.
Create and push only after the audit and local verification pass:
gh repo create OWNER/REPOSITORY \
--public \
--source=. \
--remote=origin \
--push \
--description "CONCRETE_DESCRIPTION"
Use --private unless public visibility is authorized. When the repository already exists, configure its remote explicitly and push without recreating it.
Classify the project before enabling Pages:
main and /.main and /docs.Read references/github-pages.md before changing Pages settings. Set the repository homepage to the resulting public URL and add a small set of accurate discovery topics.
Read back all external changes:
gh repo view OWNER/REPOSITORY \
--json nameWithOwner,url,visibility,description,homepageUrl,defaultBranchRef
gh api repos/OWNER/REPOSITORY/pages
gh api repos/OWNER/REPOSITORY/pages/builds/latest
Wait until the Pages build reports built or fails concretely. Then open the public URL and verify:
Keep the public page open for the user when it is the requested deliverable.
Return:
Distinguish “pushed,” “Pages configured,” “Pages built,” and “live site verified.” Never collapse them into one success claim.
file:// preview proves GitHub Pages compatibility.scripts/audit_public_project.sh before packaging or publishing.references/github-pages.md before configuring or debugging Pages.assets/README-template.md and rewrite every placeholder from project evidence.