(feat): Working clone script

This commit is contained in:
Blake Ridgway 2024-08-08 12:28:32 -05:00
commit 4b4887ba70
2 changed files with 33 additions and 0 deletions

6
README.md Normal file
View file

@ -0,0 +1,6 @@
# Clone Repos
**Prerequisites**
- The `gh` command-line tool must be installed, this will allow you to interact directly with Github in your terminal.

27
clone_repos.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# Prompt for Github username
read -p "Enter your Github username: " GITHUB_USER
# Prompt for directory for cloning
read -p "Enter the directory where you want to clone the repos: " CLONE_DIR
# Create the directory if not present
mkdir -p "$CLONE_DIR"
# Nav to directory
cd "$CLONE_DIR" || exit
# Fetch all repos
repos=$(gh repo list "$GITHUB_USER" --limit 100 --json nameWithOwner --jq '.[].nameWithOwner')
for repo in $repos; do
git clone "git@github.com:$repo.git"
echo "$repo has been cloned"
done
echo "All repos have been cloned into $CLONE_DIR"