Skip to content

Instantly share code, notes, and snippets.

@BhargavMantha
Created July 12, 2020 00:49
Show Gist options
  • Select an option

  • Save BhargavMantha/e58db6712eaa814b2a9f04c08498fb7f to your computer and use it in GitHub Desktop.

Select an option

Save BhargavMantha/e58db6712eaa814b2a9f04c08498fb7f to your computer and use it in GitHub Desktop.
This is the sh file of linux to clone private repositories of the user
#!/bin/bash
#!!!This is for Internal use only use at your own risk
#optional change working_dir
# working_dir=${1-$(pwd)}
# cd $working_dir
GHUSER="<USERNAME>"
GITHUB_API_PASSWORD="<Password>"
repo_list=$(curl -S --user ${GHUSER}:${GITHUB_API_PASSWORD} \
https://api.github.com/user/repos?visibility=private |
grep -e 'clone_url*' | cut -d \" -f 4)
for repo in $repo_list; do
echo "Repo found: $repo"
git remote set-url $repo
git clone $repo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment