vcspull import gitlab¶
Import repositories from GitLab or a self-hosted GitLab instance.
Command¶
Import repositories from GitLab (gitlab.com or self-hosted).
Usage¶
usage: vcspull import gitlab [-h] [-w DIR] [-l LANG] [--topics TOPICS] [--min-stars N] [--archived] [--forks] [--limit N] [-f FILE] [--dry-run] [--yes] [--json] [--ndjson] [--https] [--sync] [--prune] [--prune-untracked] [--color {auto,always,never}] [--token TOKEN] [-m {user,org,search}] [--url URL] [--flatten-groups] [--with-shared] [--skip-group GROUP] TARGET
Positional Arguments¶
- target TARGET¶
User, org name, or search query. For GitLab, supports subgroups with slash notation (e.g., parent/child).
Options¶
- -w, --workspace DIR¶
Workspace root directory (REQUIRED)
- --token TOKEN¶
API token (overrides env var; prefer env var for security)
- -m, --mode¶
Import mode: user (default), org, or search
- --url URL¶
Base URL for self-hosted GitLab (optional)
- --flatten-groups¶
For ``--mode org``, flatten subgroup repositories into the base workspace instead of preserving subgroup paths
- --skip-group GROUP¶
Exclude repos whose namespace contains GROUP as a path segment (repeatable: --skip-group bots --skip-group archived)
Filtering¶
Output¶
- -f, --file FILE¶
Config file to write to (default: ~/.vcspull.yaml)
- --dry-run, -n¶
Preview without writing to config file
- --yes, -y¶
Skip confirmation prompt
- --json¶
Output as JSON
- --ndjson¶
Output as NDJSON (one JSON per line)
- --https¶
Use HTTPS clone URLs instead of SSH (default: SSH)
- --sync¶
Sync config with remote: update URLs for existing entries whose URL has changed, and remove entries no longer on the remote. Preserves all metadata (options, remotes, shell_command_after). Respects pinned entries (options.pin.import).
- --prune¶
Remove config entries tagged by a previous import that are no longer on the remote. Does not update URLs for existing entries (use --sync for that). Implied by --sync. Respects pinned entries.
- --prune-untracked¶
With --sync or --prune, also remove config entries in the target workspace that lack import provenance (e.g. manually added repos). Entries imported from other sources and pinned entries are preserved. Requires --sync or --prune.
- --color¶
When to use colors (default: auto)
Subgroup targeting¶
Use slash notation to target a specific subgroup or sub-subgroup directly:
$ vcspull import gl my-group/my-subgroup \
--mode org \
--workspace ~/code/
$ vcspull import gl my-group/my-subgroup/my-leaf \
--mode org \
--workspace ~/code/
The TARGET argument accepts any depth of slash-separated group path.
Group flattening¶
When importing a GitLab group with --mode org, vcspull preserves subgroup
structure as nested workspace directories by default. Use --flatten-groups to
place all repositories directly in the base workspace:
$ vcspull import gl my-group \
--mode org \
--workspace ~/code/ \
--flatten-groups
Workspace structure by target and flag¶
Given a group tree my-group → sub → leaf, importing from ~/code/:
Target |
|
Workspace sections written |
|---|---|---|
|
no |
|
|
yes |
|
|
no |
|
|
yes |
|
|
no |
|
|
yes |
|
When the target is already the deepest group (a leaf), --flatten-groups has
no effect — all repositories already land in the base workspace.
Skipping subgroups¶
Use --skip-group to exclude all repositories whose owner path contains a
specific group name segment. Matching is case-insensitive and segment-based:
$ vcspull import gl my-group \
--mode org \
--workspace ~/code/ \
--skip-group bots
Repeat the flag to skip multiple groups:
$ vcspull import gl my-group \
--mode org \
--workspace ~/code/ \
--skip-group bots \
--skip-group archived
The flag matches any path segment: --skip-group bots skips repos owned by
my-group/bots or my-group/bots/subteam but not my-group/robotics.
Note: Passing the root group name itself (
--skip-group my-orgwhen importingmy-org) will silently exclude every repository, since all repo paths include the root group as a path segment.
Authentication¶
Env vars:
GITLAB_TOKEN(primary),GL_TOKEN(fallback)Token type: Personal access token
Scope:
read_api(minimum for listing projects; required for search mode)Create at: https://gitlab.com/-/user_settings/personal_access_tokens (self-hosted:
https://<instance>/-/user_settings/personal_access_tokens)
Set the token:
$ export GITLAB_TOKEN=glpat-...
Then import:
$ vcspull import gl myuser --workspace ~/code/