LinuxCommandLibrary

glab-repo

Create, clone, and manage GitLab repositories

TLDR

Create a new repository (if the repository name is not set, the default name will be the name of the current directory)

$ glab repo create [name]
copy

Clone a repository
$ glab repo clone [owner]/[repository]
copy

Fork and clone a repository
$ glab repo fork [owner]/[repository] [[-c|--clone]]
copy

View a repository in the default web browser
$ glab repo view [owner]/[repository] [[-w|--web]]
copy

Search some repositories in the GitLab instance
$ glab repo search [[-s|--search]] [search_string]
copy

SYNOPSIS

glab repo <command> [flags] [args]

PARAMETERS

-R, --repo <REPO>
    Select repo(s) by OWNER/REPO or GROUP/SUBGROUP/REPO (multiple OK, defaults to current git repo)

-h, --help
    Show help for repo

DESCRIPTION

glab repo is a subcommand of the official glab GitLab CLI tool for managing repositories from the command line. It supports key operations like creating new repos with visibility controls, forking projects, cloning to local with custom remotes, viewing details (README, licenses, stars), listing user/group repos with filters, archiving, deleting, and transferring ownership.

Designed for efficiency, it uses GitLab REST/GraphQL APIs, handles pagination, and offers output formats: table, JSON, YAML, or templates. Works with GitLab.com, self-hosted (specify --gitlab-url), and integrates with git repos (auto-detects current repo).

Authentication via glab auth login (browser/OAuth/PAT). Perfect for scripting, CI/CD (e.g., auto-fork in pipelines), and daily workflows. Written in Go, single binary, no deps.

Enhances productivity over web UI for bulk ops or remote servers.

CAVEATS

Elevated perms needed for delete/archive/transfer; verify auth/URL for self-hosted; some subcmds require git installed.

SUBCOMMANDS

archive, clone, create, delete, fork, list, transfer, view

EXAMPLE USAGE

glab repo create myproj --public
glab repo fork gitlab-org/gitlab
glab repo view --branch main

HISTORY

Part of glab CLI by GitLab Inc.; beta 2020, v1.0.0 March 2021 with core repo cmds; evolved with GitLab API v4/v5 support.

SEE ALSO

glab(1), git(1), gh repo(1)

Copied to clipboard