Installation
Installation
Docker
You can run the CLI using Docker. It is available on GitHub Container Registry.
- Pull the Docker image:
docker pull ghcr.io/boxboxjason/gitlab-sync:latest - Run the Docker container with the required command line arguments / env variables (don’t forget to mount the JSON file):
docker run --rm \
-e SOURCE_GITLAB_URL=<source_gitlab_url> \
-e SOURCE_GITLAB_TOKEN=<source_gitlab_token> \
-e DESTINATION_GITLAB_URL=<destination_gitlab_url> \
-e DESTINATION_GITLAB_TOKEN=<destination_gitlab_token> \
-e MIRROR_MAPPING=/home/gitlab-sync/mirror.json \
-v <my_mapping_json_file>:/home/gitlab-sync/mirror.json:ro,Z \
ghcr.io/boxboxjason/gitlab-sync:latestInstall with go install
You can install the latest published version directly with Go:
go install github.com/boxboxjason/gitlab-sync@latestTo install a specific version, use a semantic version tag:
go install github.com/boxboxjason/gitlab-sync@v1.2.3By default, go install places the binary in $(go env GOPATH)/bin.
If this directory is not in your PATH, either run the binary with its full path:
"$(go env GOPATH)/bin/gitlab-sync" --versionOr add it to your shell profile:
export PATH="$(go env GOPATH)/bin:$PATH"Then run:
gitlab-sync --versionCompile from source
To compile the CLI from source, you need to have Go installed on your machine.
- Clone the repository:
git clone https://github.com/boxboxjason/gitlab-sync.git - Change to the project directory:
cd gitlab-sync - Build the CLI:
go build -o bin/gitlab-sync . - The binary will be created in the
bindirectory. - Make sure the binary is executable:
chmod +x bin/gitlab-sync - You can run the CLI from the
bindirectory:./bin/gitlab-sync - Optionally, you can move the binary to a directory in your
PATHfor easier access:mv bin/gitlab-sync /usr/local/bin/
Shell autocomplete
The CLI provides shell completions, including completion for available flags on the main command.
Generate completion script:
gitlab-sync completion bash
gitlab-sync completion zsh
gitlab-sync completion fish
gitlab-sync completion powershellExamples:
# Bash (current session)
source <(gitlab-sync completion bash)
# Zsh (save then source from ~/.zshrc)
gitlab-sync completion zsh > "${fpath[1]}/_gitlab-sync"
# Fish
gitlab-sync completion fish > ~/.config/fish/completions/gitlab-sync.fish