gemini://sunshinegardens.org


title: quickly export gitlab projects date: 2019-10-21T19:20:00-06:00 tags: technology


depending on your project settings, these commands may need to be repeated with `&visibility=public`, `&visibility=internal`, and `&visibility=private` added to the `/users` request. gitlab does not return the full list of projects in one request. you will need to repeat the mirror and delete commands until the list is exhausted.

git config --global credential.helper cache
git clone --mirror $some_private_repo
curl \
    -H "Authorozation: Bearer $personal_access_token" \
    -H "Accept: application/json" \
    "https://gitlab.com/api/v4/users/$username/projects?limit=100" \
    | jq .[].http_url_to_repo \
    | xargs -n1 -P4 git clone --mirror
curl \
    -H "Authorozation: Bearer $personal_access_token" \
    -H "Accept: application/json" \
    "https://gitlab.com/api/v4/users/$username/projects?limit=100" \
    | jq .[].id \
    | xargs -n1 -P4 -I{} \
    	curl \
    		-H "Authorization: Bearer $personal_access_token" \
    		-X DELETE \
    		"https://gitlab.com/api/v4/projects/{}"