← 返回
开发者工具 中文

Open Source Release

Convert a private repository to public open-source. Use when making a repo public, sanitizing personal info from code/docs/git history, or preparing a projec...
将私有仓库转为公开开源仓库。适用于将仓库公开、清除代码/文档/git 历史中的个人信息,或准备项目等场景。
jini92
开发者工具 clawhub v1.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 779
下载
💾 6
安装
1
版本
#latest

概述

---

name: opensource-release

description: Convert a private repository to public open-source. Use when making a repo public, sanitizing personal info from code/docs/git history, or preparing a project for open-source release. Triggers on "open source", "make public", "public release", "sanitize repo".


Open Source Release

Safely convert a private repo to public by sanitizing personal data and cleaning history.

Pre-flight Checklist

  1. Scan source code — search for:
    • Absolute paths: C:\Users\, home directory references
    • Usernames: OS-specific account names
    • Internal hostnames / port names
    • API keys / tokens: .env, hardcoded secrets
    • Email / phone numbers in commit author config
  1. Check cached artifacts — ensure .gitignore covers:
    • Binary caches (.pkl, .db, checksums.json)
    • __pycache__/, node_modules/, .env, *.egg-info/
    • Project-specific cache directories

Sanitization Steps

Step 1: Code Scan

# Find hardcoded paths and usernames
Get-ChildItem -Recurse -Include "*.py","*.ps1","*.js","*.ts" |
  Select-String -Pattern "C:\\Users|/home/|your-username" -SimpleMatch |
  Where-Object { $_.Path -notmatch "__pycache__|node_modules|\.git" }

Fix: replace with environment variables (os.environ.get / process.env) and add a .env.example.

Step 2: Docs Scan

Get-ChildItem -Recurse -Include "*.md","*.txt","*.yaml","*.yml" |
  Select-String -Pattern "C:\\Users|/home/|your-username" -SimpleMatch |
  Where-Object { $_.Path -notmatch "node_modules|\.git" }

Replace personal paths with generic placeholders ($VAULT_PATH, ~/vault, etc.).

Step 3: Git History Analysis

git log --all -p | Select-String -Pattern "SENSITIVE_TERM" | Select-Object -First 50
git log --all --diff-filter=A -- "cache/*"

Choose a strategy:

  • < 50 commits + cache only in history → Option B (clean push)
  • Large history with sensitive data → Option A (BFG Repo Cleaner / git filter-repo)
  • History is fine, just old paths → Option C (leave as-is)

Step 4: Clean Push (Option B)

git checkout --orphan clean-main
git add -A
git commit -m "feat: initial public release"
git remote set-url origin https://github.com/{owner}/{repo}.git  # verify no token in URL!
git branch -M main
git push origin main --force
git push origin --delete {old-branch}

Step 5: Make Public

gh repo edit {owner}/{repo} --visibility public --accept-visibility-change-consequences --description "Short description"

Step 6: Verify

# Final scan for sensitive strings
Get-ChildItem -Recurse -Include "*.py","*.md","*.yaml","*.js","*.ts" |
  Select-String -Pattern "SENSITIVE_TERM" -SimpleMatch |
  Where-Object { $_.Path -notmatch "__pycache__|node_modules|\.git" }

# Confirm remote URL has no token
git remote -v

# Confirm visibility
gh repo view {owner}/{repo} --json visibility

Step 7: Post-Release Housekeeping (Optional)

  • Add issue tracking to HEARTBEAT.md
  • Update memory/{project}.md with release notes

Gotchas

  • Never include tokens in git remote URLs — always verify before push
  • Binary caches not covered by .gitignore may already be in history — check carefully
  • Encoding issues on Windows — use UTF-8 explicitly in PowerShell/Python
  • Your GitHub username is already public — that is fine to leave as-is
  • Never commit .env files — add to .gitignore if not already there

版本历史

共 1 个版本

  • v1.1.0 当前
    2026-03-30 01:14 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 66 📥 179,854
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 667 📥 323,814
content-creation

Obsidian Daily Note

jini92
创建并管理 Obsidian 每日笔记。用于在需要写每日笔记、记录今日工作、记录会话活动或创建每日摘要时被触发。
★ 1 📥 834