Last active
February 13, 2019 20:17
-
-
Save yannicklamprecht/0f195aee35d113211114089e89aa4769 to your computer and use it in GitHub Desktop.
A script that clones all repositories you have access to of a gitlab instance. (It requires jq to parse and access JSON easily)
This file contains 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
#!/bin/bash | |
if [ $# -ne 3 ] | |
then | |
echo "$0 <gitlab_url> <private_token> <per_page>" | |
exit 1 | |
fi | |
gitlab_url=$1 | |
private_token=$2 | |
per_page=$3 | |
urls=( $(curl "${gitlab_url}?private_token=${private_token}&per_page=${per_page}" | jq -r '.[].http_url_to_repo') ) | |
for i in "${urls[@]}" | |
do | |
echo "Try Cloning $i" | |
git clone $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment