Created
October 7, 2021 19:47
-
-
Save quonic/d2a87d498584d403c6ed63749d13b36a to your computer and use it in GitHub Desktop.
Backup/Export GitLab repositories
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
# This will clone each repo that your user/token has access to. | |
# I created this to help backup the repo's, then wipe the gitlab server, reinstall, and restore. | |
$token = "<YourTokenHere>" | |
$Url = "https://<YourDomainHere>/api/v4/projects/?per_page=500" | |
$Projects = Invoke-RestMethod -Headers @{ 'PRIVATE-TOKEN' = $token } -Method Get -Uri $Url | |
$Projects.http_url_to_repo | ForEach-Object { | |
git.exe clone $_ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is for a free self hosted version.
This will get rate limited with a 429 HTTP error. Just rerun it a few more times until you get
fatal: destination path 'MyRepo' already exists and is not an empty directory.
for each repo.