Automate the cleanup of your GitHub profile by syncing and privatizing old forks in bulk.
Forking repositories is great for open source contribution, but over time, your profile gets cluttered with dozens of abandoned forks. This hides your actual original projects from recruiters and visitors.
This tool uses the GitHub CLI (gh) to safely tidy up your profile:
- Safety Filter: Identifies only forks (keeping your original creations safe).
- Sync: Updates the forks with the latest code from the original author.
- Unlock & Hide: Automatically unarchives "locked" repositories so they can be modified.
- Privatize: Moves them to private visibility to clean up your profile.
You must install the official GitHub CLI tool.
๐ด DO NOT use npm install gh (This installs an unrelated, broken package that will cause errors).
๐ข USE THIS INSTEAD:
- Windows:
winget install --id GitHub.cli - Mac:
brew install gh - Linux:
sudo apt install gh
Authenticate with your GitHub account:
gh auth login- Download the clean.sh file from this repository.
- Open your terminal (Git Bash, PowerShell, or Terminal).
- Run the script:
sh clean.sh- Review the list: The script will show you exactly which repos will be moved.
- Confirm: Type y to start the cleanup.
If you prefer running a single command without downloading the script:
gh repo list --fork --visibility public --limit 1000 --json nameWithOwner --jq '.[].nameWithOwner' | xargs -I {} sh -c 'gh repo sync {} || true; gh repo unarchive {} --yes; gh repo edit {} --visibility private --accept-visibility-change-consequences'This project is open-source and available under the MIT License.