Last active
October 23, 2024 02:37
-
-
Save jimdiroffii/4e3b240774f8e0cfc91813e715fc6c7a to your computer and use it in GitHub Desktop.
Clone all personal repos using PowerShell or Bash
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 characters
# Install Github CLI | |
winget install -e --id GitHub.cli | |
# Log into Github | |
gh auth login | |
mkdir c:\_all | |
cd c:\_all | |
gh repo list | ForEach-Object { gh repo clone $_.Split("`t")[0] } |
Bash script:
gh repo list <your-username> --limit 1000 --json name,sshUrl | jq -r '.[] | .sshUrl' | while read repo; do
repo_name=$(basename "$repo" .git)
if [ ! -d "$repo_name" ]; then
git clone "$repo"
else
echo "Repository $repo_name already exists, skipping..."
fi
done
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Original script by @KarsonAlford https://gist.github.com/KarsonAlford/f26f1bcca772d9ac6a76d8594155f923