-
Notifications
You must be signed in to change notification settings - Fork 0
How To Guide
Welcome! This guide will help you use the GitLab Crawler tool to extract data from your GitLab instance. No programming experience is required.
- What Does This Tool Do?
- Before You Start
- Quick Start Guide
- Step-by-Step Setup
- Running Your First Crawl
- Understanding the Output
- Advanced Features
- Troubleshooting
- Common Questions
The GitLab Crawler is a command-line tool that extracts information from your GitLab server and saves it to files on your computer. It can collect:
- Groups and Projects: All the groups and projects you have access to
- Users: Information about all users in your GitLab instance
- Issues and Merge Requests: All issues, merge requests, and their details
- Repository Data: Commits, branches, tags, and file contents
The tool saves everything in a structured format (JSONL files) that can be easily analyzed or imported into other systems.
-
Access to a GitLab Instance
- You need a GitLab server URL (e.g.,
https://gitlab.comor your company's GitLab server) - You need appropriate permissions to view the data you want to crawl
- You need a GitLab server URL (e.g.,
-
Authentication Credentials
- Either a Personal Access Token from GitLab, or
- OAuth2 credentials (Client ID and Client Secret) from your GitLab administrator
-
Installed Software
- This tool should already be installed. If not, ask your system administrator.
-
Disk Space
- Ensure you have enough disk space. A large GitLab instance might produce several gigabytes of data.
If you're already familiar with command-line tools, here's the fastest way to get started:
# 1. Run the interactive setup wizard
copima-cli-crawler setup
# 2. Authenticate with GitLab
copima-cli-crawler auth
# 3. Run a complete crawl
copima-cli-crawler crawl
# That's it! Your data will be in the ./output directoryIf you're new to command-line tools or want more detailed instructions, continue reading the step-by-step guide below.
On Windows:
- Press
Win + R, typecmd, and press Enter
On Mac:
- Press
Cmd + Space, typeterminal, and press Enter
On Linux:
- Press
Ctrl + Alt + Tor search for "Terminal" in your applications
Type the following command and press Enter:
copima-cli-crawler --versionYou should see a version number (e.g., 0.1.0). If you get an error like "command not found", the tool isn't installed yet. Contact your system administrator.
The easiest way to configure the tool is using the interactive setup wizard:
copima-cli-crawler setupThe wizard will ask you several questions:
-
GitLab Host: Enter your GitLab server URL
- Example:
https://gitlab.comorhttps://gitlab.mycompany.com
- Example:
-
Authentication Method: Choose how you want to authenticate
- Option A: Use a Personal Access Token (simpler, recommended for beginners)
- Option B: Use OAuth2 (more secure, but requires setup from your admin)
-
Configuration File Location: Where to save your settings
- Press Enter to use the default location (
./copima.yaml) - Or specify a custom path
- Press Enter to use the default location (
The wizard will save your configuration and automatically start the authentication process.
-
Log in to your GitLab instance in a web browser
-
Go to your User Settings → Access Tokens
-
Create a new token with these scopes (permissions):
-
api- Full API access -
read_user- Read user information -
read_repository- Read repository data
-
-
Copy the generated token
-
Run the authentication command:
copima-cli-crawler account:add --access-token YOUR_TOKEN_HERE
If you configured OAuth2 during setup, the wizard automatically started the authentication flow. If not, run:
copima-cli-crawler authThis will:
- Open your web browser automatically
- Ask you to log in to GitLab
- Request permission to access your data
- Save the credentials automatically
Note: Your browser might show a warning about a "self-signed certificate" or "unsecured connection" on localhost. This is normal and safe - click "Advanced" and proceed.
Now that you're set up and authenticated, you can start crawling!
Start with a basic crawl to make sure everything works:
copima-cli-crawler crawlThis command will:
- Connect to your GitLab instance
- Crawl all data in 4 steps (groups, users, resources, repositories)
- Show progress in your terminal
- Save data to the
./outputdirectory
Note: For large GitLab instances, this might take several minutes or even hours. Be patient!
If you only want specific types of data, you can run individual steps:
copima-cli-crawler areascopima-cli-crawler userscopima-cli-crawler resourcescopima-cli-crawler repositoryYou can also use the main crawl command with the --steps option:
# Only crawl groups/projects and users
copima-cli-crawler crawl --steps areas,users
# Only crawl repository data
copima-cli-crawler crawl --steps repositoryBy default, data is saved to ./output. To use a different location:
copima-cli-crawler crawl --output /path/to/your/folderAfter a successful crawl, your output directory will look like this:
output/
├── areas/
│ ├── groups.jsonl
│ └── projects.jsonl
├── users/
│ └── users.jsonl
├── [group-name]/
│ ├── issues.jsonl
│ ├── merge_requests.jsonl
│ ├── labels.jsonl
│ └── members.jsonl
└── [project-name]/
├── commits.jsonl
├── branches.jsonl
├── tags.jsonl
└── repository_tree.jsonl
JSONL (JSON Lines) is a text format where each line is a separate JSON object. You can:
- Open it in any text editor
- Import it into Excel, Google Sheets, or other tools
- Process it with data analysis tools like Python, R, or databases
On Windows (using Notepad):
notepad output/users/users.jsonlOn Mac/Linux (using less):
less output/users/users.jsonlEach line represents one record (user, project, issue, etc.).
During crawling, the tool creates progress files:
-
progress.yaml- Current crawling status -
resume-state.yaml- Checkpoint for resuming interrupted crawls
You don't need to edit these files manually.
If your crawl was interrupted (e.g., network issue, computer shutdown), you can resume from where it stopped:
copima-cli-crawler crawl --resume trueThe tool will check what was already crawled and continue from there.
To test your configuration without actually crawling data:
copima-cli-crawler crawl --dry-run trueThis validates your credentials and settings without downloading anything.
To see more detailed information about what the tool is doing:
copima-cli-crawler crawl --verbose trueUseful for debugging or understanding what's happening during the crawl.
You can store multiple GitLab accounts and switch between them:
# Add a second account
copima-cli-crawler account:add --host https://gitlab.company2.com --access-token TOKEN2
# List all accounts
copima-cli-crawler account:list
# Use a specific account
copima-cli-crawler crawl --account-id ACCOUNT_ID_FROM_LISTView your current configuration:
copima-cli-crawler config:showChange a configuration value:
copima-cli-crawler config:set --key gitlab.host --value https://gitlab.comRemove a configuration value:
copima-cli-crawler config:unset --key gitlab.hostValidate your configuration:
copima-cli-crawler config:validateSolution: The tool isn't installed or not in your PATH. Contact your system administrator.
Possible causes and solutions:
- Expired token: Create a new Personal Access Token in GitLab
- Wrong token: Double-check you copied the entire token
- Insufficient permissions: Make sure your token has the required scopes (api, read_user, read_repository)
Try running the setup wizard again:
copima-cli-crawler setupPossible causes and solutions:
-
Wrong URL: Verify your GitLab instance URL
copima-cli-crawler config:show
-
Network issues: Check your internet connection
-
Firewall: Your network might be blocking the connection. Contact your IT department.
-
Self-signed certificates: If your GitLab uses self-signed SSL certificates, you may need to disable SSL verification (ask your administrator).
Solution: Free up disk space or specify a different output directory:
copima-cli-crawler crawl --output /path/to/larger/drivePossible causes and solutions:
-
Large GitLab instance: Normal for instances with thousands of projects. Be patient.
-
Network speed: Slow internet connection affects crawling speed.
-
GitLab rate limits: The tool respects rate limits. This is expected and cannot be bypassed.
Solution: Resume from where it stopped:
copima-cli-crawler crawl --resume trueIf you're still having issues:
- Check the main README.md for technical details
- Enable verbose logging to see detailed error messages:
copima-cli-crawler crawl --verbose true - Contact your system administrator
- If you're technical, check the GitHub repository for issues and discussions
A: It depends on the size of your GitLab instance:
- Small (< 100 projects): 5-15 minutes
- Medium (100-1000 projects): 30 minutes - 2 hours
- Large (> 1000 projects): Several hours
A: Approximate estimates:
- Small instance: 100-500 MB
- Medium instance: 500 MB - 5 GB
- Large instance: 5-50 GB or more
Check your available disk space before starting.
A: No, running multiple crawls to the same output directory will cause conflicts. Use different output directories:
# Terminal 1
copima-cli-crawler crawl --output ./output1
# Terminal 2
copima-cli-crawler crawl --output ./output2A: Yes:
- Your credentials are stored locally in an encrypted database
- Data is saved only on your computer
- The tool doesn't send data to any third-party services
- All communication with GitLab is encrypted (HTTPS)
A: Yes! You can schedule the crawler using:
- Windows: Task Scheduler
- Mac/Linux: cron jobs
Example cron job (runs daily at 2 AM):
0 2 * * * /usr/local/bin/copima-cli-crawler crawl --output /path/to/outputA: The tool can only access what your GitLab account can access. If you need to crawl:
- Public projects: Any account works
- Internal projects: You need to be logged into the GitLab instance
- Private projects: You need explicit access to those projects
A: Yes, use the --steps option to crawl specific data types. For more advanced filtering, you'll need to modify the configuration file or use data callbacks (see technical documentation in README.md).
A: No worries! You can:
- Delete the output directory and start over
- Run the setup wizard again:
copima-cli-crawler setup - Change individual settings:
copima-cli-crawler config:set --key KEY --value VALUE
A: JSONL files can be very large. Instead of opening the entire file:
- Use command-line tools to view parts:
head -n 100 output/users/users.jsonl - Import into a database for analysis
- Use specialized tools like
jqfor JSON processing - Split into smaller files using command-line tools
# Initial setup
copima-cli-crawler setup
# Authenticate
copima-cli-crawler auth
# Run complete crawl
copima-cli-crawler crawl
# Run specific steps
copima-cli-crawler crawl --steps areas,users
# Resume interrupted crawl
copima-cli-crawler crawl --resume true
# Test configuration
copima-cli-crawler crawl --dry-run true
# View configuration
copima-cli-crawler config:show
# List accounts
copima-cli-crawler account:list
# Get help
copima-cli-crawler --help
copima-cli-crawler crawl --help| Flag | Description | Example |
|---|---|---|
--host |
GitLab instance URL | --host https://gitlab.com |
--access-token |
Personal Access Token | --access-token glpat-xxx... |
--output |
Output directory | --output ./my-data |
--steps |
Which steps to run | --steps areas,users |
--resume |
Resume from checkpoint | --resume true |
--dry-run |
Test without crawling | --dry-run true |
--verbose |
Detailed logging | --verbose true |
--help |
Show help | --help |
Now that you've completed your first crawl:
- Explore the data: Browse through the output directory and open some JSONL files
- Analyze the data: Import files into your preferred analysis tool
- Automate: Set up regular crawls if needed
- Share: The JSONL format makes it easy to share data with team members
For technical details, advanced configuration, and developer information, see the main README.md file.
Happy Crawling! 🚀
If you found this guide helpful or have suggestions for improvements, please share your feedback with your system administrator or contribute to the project on GitHub.