Skip to content

Instantly share code, notes, and snippets.

@Tyrrrz
Created May 26, 2023 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tyrrrz/23fa7dda288673f891ebd05361e7b5aa to your computer and use it in GitHub Desktop.
Save Tyrrrz/23fa7dda288673f891ebd05361e7b5aa to your computer and use it in GitHub Desktop.
GitHub CLI script to delete all forks
gh auth login --web
$owner = "" # leave empty for current user
$repos = gh repo list $owner --fork --json nameWithOwner | ConvertFrom-Json
foreach ($repo in $repos) {
$repoName = $repo.nameWithOwner
Write-Host "Deleting repository: $repoName..."
Read-Host -Prompt "Press ENTER to confirm..."
gh repo delete $repoName --yes | Out-Null
}
Write-Host "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment