Created
          September 23, 2023 03:00 
        
      - 
      
- 
        Save Jerdak/e35e2bd1f841d347871ca43759283fc8 to your computer and use it in GitHub Desktop. 
Revisions
- 
        Jerdak created this gist Sep 23, 2023 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ * Install Homebrew: https://brew.sh/ * Install Github CLI: https://cli.github.com/ Linux ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install gh ``` This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ # Back up all repositories starting with a certain set of characters. # # Replace `<GithubAccountName>/...` with the start of the repo(s) you want to remove. e.g. Jerdak/foo_ gh repo list --json nameWithOwner --jq '.[] | select(.nameWithOwner | startswith("<GithubAccountName>/...")) | .nameWithOwner' | while read -r repo; do owner=$(echo "$repo" | cut -d '/' -f 1) repo_name=$(echo "$repo" | cut -d '/' -f 2) gh repo clone "$owner/$repo_name" cd "$repo_name" tar czf "../${repo_name}.tar.gz" . cd .. rm -rf "$repo_name" done This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ # Delete all repositories starting with a certain set of characters # # Replace `<GithubAccountName>/...` with the start of the repo(s) you want to remove. e.g. Jerdak/foo_ gh repo list --json nameWithOwner --jq '.[] | select(.nameWithOwner | startswith("Jerdak/difz")) | .nameWithOwner' | while read -r repo; do owner=$(echo "$repo" | cut -d '/' -f 1) repo_name=$(echo "$repo" | cut -d '/' -f 2) echo "Deleting: $owner/$repo_name" # UNCOMMENT ME TO ACTUALLY DELETE (will require `gh auth refresh -s delete_repo` to have been run at least once) #gh repo delete "$owner/$repo_name" --yes done