Skip to content

Usage

The CLI requires no dependencies and can be run directly. It is available as a single binary executable.

The mirroring configuration can be passed by either command line arguments or environment variables. If mandatory arguments are not provided, the program will prompt for them, unless --no-prompt is set.

The full --help output of the CLI is available in the CLI reference.

Arguments

ArgumentEnvironment Variable equivalentMandatoryDescription
--help or -hN/ANoShow help message and exit
--versionN/ANoShow version information and exit
--verbose or -vN/ANoEnable verbose output
--no-prompt or -nNO_PROMPTNoNever prompt for missing values, fail instead (any non-empty value of the environment variable enables it)
--dry-runN/ANoPerform a dry run without making any changes
--source-urlSOURCE_GITLAB_URLYesURL of the source GitLab instance
--source-tokenSOURCE_GITLAB_TOKENNoAccess token for the source GitLab instance
--source-bigSOURCE_GITLAB_BIGNoSpecify if the source GitLab instance is a big instance (default: false, any non-empty value of the environment variable enables it)
--destination-urlDESTINATION_GITLAB_URLYesURL of the destination GitLab instance
--destination-force-freemium or -fN/ANoForce the destination GitLab to be treated as a non-premium instance (default: false)
--destination-force-premium or -pN/ANoForce the destination GitLab to be treated as a premium instance (default: false)
--destination-tokenDESTINATION_GITLAB_TOKENYesAccess token for the destination GitLab instance
--destination-bigDESTINATION_GITLAB_BIGNoSpecify if the destination GitLab instance is a big instance (default: false, any non-empty value of the environment variable enables it)
--mirror-mappingMIRROR_MAPPINGYesPath to a JSON file containing the mirror mapping
--retry or -rN/ANoNumber of retries for failed GitLab API requests (default: 3, -1 for no limit)
--log-fileGITLAB_SYNC_LOG_FILENoPath to a log file for output logs (default: none, only outputs logs to stderr)
--cache-dirGITLAB_SYNC_CACHE_DIRNoDirectory keeping the cloned repositories between runs, to avoid cloning them again (freemium mirroring only, default: none, caching disabled). See caching
--cache-max-ageGITLAB_SYNC_CACHE_MAX_AGENoDelete the cached repositories that have not been synchronized for that long (Go duration, 0 keeps them forever, default: 168h, 7 days)
--user-agentGITLAB_SYNC_USER_AGENTNoUser-Agent sent with every GitLab API request; git clone, fetch and push requests keep the go-git default (default: gitlab-sync/<version>)

Example

gitlab-sync \
  --source-url https://gitlab.example.com \
  --source-token <source_gitlab_token> \
  --destination-url https://mycompany.example.com \
  --destination-token <destination_gitlab_token> \
  --mirror-mapping /path/to/mirror.json

Add --dry-run to see what would change without writing anything to the destination.