Skip to content

Instantly share code, notes, and snippets.

@yannicklamprecht
Last active February 13, 2019 20:17
Show Gist options
  • Save yannicklamprecht/0f195aee35d113211114089e89aa4769 to your computer and use it in GitHub Desktop.
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)
#!/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