A powerful, multi-version GitLab backup tool that exports all your accessible content from multiple GitLab instances. Choose from three implementations based on your needs: a beautiful async TUI, a secure encrypted version, or a simple straightforward exporter.
- π¨ Rich Terminal UI - Beautiful async interface with real-time progress tracking
- π Encrypted Storage - Secure credential management with password protection
- π¦ Complete Exports - Projects, wikis, snippets, issues, and merge requests
- β‘ Concurrent Downloads - Export multiple projects simultaneously
- π Resume Support - Skip already exported projects
- π’ Multi-Instance - Export from multiple GitLab instances in one run
- π³ Docker Ready - Run in containers with batch or scheduled modes
- π Export Reports - Detailed JSON reports of all operations
# Clone the repository
git clone https://github.com/yourusername/gitsport.git
cd gitsport
# Run the interactive setup
python3 quickstart.py
# OR
./start.sh# Install dependencies
pip install -r requirements-async.txt
# Run the async TUI version (recommended)
python3 gitlab_async_tui_exporter.py# Run with Docker Compose
docker-compose up --buildBeautiful terminal interface with real-time progress tracking.
python3 gitlab_async_tui_exporter.pyBest for:
- Interactive exports with visual feedback
- Selecting specific instances to export
- Monitoring progress in real-time
Features:
- Rich terminal UI with progress bars
- Concurrent async exports
- Interactive instance selection
- Exports projects, wikis, snippets, metadata
Enterprise-grade with encrypted credential storage.
python3 gitlab_export_secure.pyBest for:
- Automated/scheduled exports
- CI/CD pipelines
- Production environments
- When security is paramount
Features:
- Encrypted credential storage
- Environment variable support
- Batch processing
- Comprehensive logging
Straightforward synchronous exporter.
python3 gitlab_export.pyBest for:
- Quick one-off exports
- Single instance exports
- Minimal dependencies
- Simple use cases
Create a config.json file:
{
"instances": [
{
"name": "production",
"url": "https://gitlab.example.com",
"token": "glpat-xxxxxxxxxxxxxxxxxxxx"
},
{
"name": "staging",
"url": "https://gitlab-staging.example.com",
"token": "glpat-yyyyyyyyyyyyyyyyyyyy"
}
],
"export_settings": {
"max_concurrent_exports": 3,
"timeout_minutes": 30
}
}export GITLAB_USE_ENV_VARS=true
export GITLAB_INSTANCE_0_NAME=production
export GITLAB_INSTANCE_0_URL=https://gitlab.example.com
export GITLAB_INSTANCE_0_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx# Create encrypted credentials interactively
./setup-docker-credentials.pyexports/
βββ instance_name/
β βββ 20240722_143030/
β βββ projects/ # Project tar.gz archives
β βββ wikis/ # Wiki pages (async version)
β βββ snippets/ # Code snippets (async version)
β βββ metadata/ # Issues & MRs (async version)
β βββ export.log # Detailed export log
β βββ errors.log # Error log
β βββ project_list.json # Project inventory
β βββ export_report.json # Summary report
docker-compose up --builddocker-compose -f docker-compose.secure.yml up gitlab-exporter-batchdocker-compose -f docker-compose.secure.yml up -d gitlab-exporter-scheduled| Feature | Async TUI | Secure | Simple |
|---|---|---|---|
| Multiple Instances | β | β | β |
| Visual Progress | β Rich UI | β Text | β Basic |
| Concurrent Exports | β | β | β |
| Encrypted Credentials | β | β | β |
| Environment Variables | β | β | β |
| Interactive Selection | β | β | β |
| Wikis & Snippets | β | β | β |
| Issues & MRs | β | β | β |
| Docker Ready | β | β | β |
| Resume Support | β | β | β |
- Python 3.7+
- GitLab Personal Access Token with
apiorread_apiscope - Dependencies:
- Async TUI:
aiohttp,rich - Secure:
requests,cryptography - Simple:
requests
- Async TUI:
- Complete Usage Guide - Detailed usage instructions
- Docker Usage - Docker-specific documentation
- Project Status - Current implementation status
- Never commit credentials - Use
.gitignorefor sensitive files - Use read-only tokens - Only
read_apiscope needed - Encrypt credentials - Use secure version for production
- Rotate tokens regularly - Update configurations as needed
# Using systemd
sudo ./install-systemd.sh
sudo systemctl enable gitlab-export.timer
# Using Docker
docker-compose -f docker-compose.secure.yml up -d gitlab-exporter-scheduledexport-gitlab:
image: python:3.11
script:
- pip install -r requirements.txt
- python3 gitlab_export_secure.py
artifacts:
paths:
- exports/# Use the async TUI for the best experience
python3 gitlab_async_tui_exporter.py
# Select which instances to export
# Watch real-time progress- Verify GitLab URL includes
https:// - Ensure token has
apiorread_apiscope - Test connection:
curl -H "PRIVATE-TOKEN: token" https://gitlab.example.com/api/v4/user
- Check available disk space
- Verify project export is enabled in GitLab settings
- Review
errors.login export directory - Try reducing concurrent exports
- Adjust
max_concurrent_exportsbased on your system - Large projects may timeout - increase
timeout_minutes - Run during off-peak hours for better performance
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues or questions:
- Check the Usage Guide
- Review logs in the export directory
- Open an issue on GitHub
Project export must be enabled in your GitLab instance for this tool to work. Here's how to enable it:
-
Enable at Instance Level:
- Go to Admin Area β Settings β General
- Expand Visibility and access controls
- Check Project export enabled
- Click Save changes
-
Via GitLab Rails Console:
# Enable project export ApplicationSetting.current.update!(project_export_enabled: true) # Verify it's enabled ApplicationSetting.current.project_export_enabled
-
Via API (requires admin token):
curl --request PUT --header "PRIVATE-TOKEN: <admin-token>" \ "https://gitlab.example.com/api/v4/application/settings?project_export_enabled=true"
If project export is enabled at the instance level, it's automatically available for all projects. You can verify by:
- Going to Project β Settings β General β Advanced
- Looking for the Export project button
If exports are failing:
- Check GitLab version (exports require GitLab 10.6+)
- Verify sufficient disk space on GitLab server
- Check Sidekiq is running (exports are processed asynchronously)
- Review GitLab logs:
/var/log/gitlab/gitlab-rails/production.log
Note: This tool requires appropriate permissions on your GitLab instance. Ensure you have the necessary access rights and that project export is enabled as described above.