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 <subcommand> [flags]

PARAMETERS

--header strings
    Add a header to the request. Can be used multiple times.

--host string
    Specify the GitLab host. Defaults to 'gitlab.com'.

--no-color
    Disable color output in the console.

--skip-prompt
    Skip prompts and use default values or non-interactive mode.

--token string
    Your GitLab access token. Overrides token from configuration.

--verbose
    Show verbose output, including HTTP requests and responses.

DESCRIPTION

The glab repo command acts as a comprehensive suite for managing GitLab repositories. It provides various subcommands to perform common repository operations directly from the command line, such as creating, cloning, listing, forking, archiving, deleting, and viewing projects. This eliminates the need to navigate the GitLab web interface for many daily tasks, streamlining developer workflows and enabling scripting. It leverages the GitLab API and requires authentication via a GitLab access token configured either through glab auth login or the --token flag, ensuring secure and direct interaction with your GitLab instance.

CAVEATS

The glab repo command itself is a command group and cannot be executed without a subcommand (e.g., glab repo create).
Most operations require a valid GitLab access token with appropriate permissions for the actions being performed (e.g., 'maintainer' role for deletion).
Network connectivity to the specified GitLab host is essential for all operations.

AVAILABLE SUBCOMMANDS

The glab repo group provides a rich set of subcommands for various repository operations:

archive: Archive a repository
clone: Clone a GitLab repository
create: Create a new GitLab repository
delete: Delete a GitLab repository
fork: Fork a GitLab repository
list: List GitLab repositories
mirror-create: Create a new mirrored GitLab repository
mirror-update: Update a mirrored GitLab repository
rename: Rename a GitLab repository
search: Search for a GitLab repository
transfer: Transfer a GitLab repository
unarchive: Unarchive a repository
view: View a GitLab repository

Each subcommand has its own specific set of flags and arguments, which can be viewed using glab repo <subcommand> --help.

HISTORY

glab, the GitLab CLI, emerged to provide a powerful command-line interface for interacting with GitLab. The repo command group has been a fundamental part of glab since its early development, offering core functionality for project management. Its evolution mirrors the active development of the GitLab platform, continually expanding its capabilities to cover more GitLab API features and improve the developer experience.

SEE ALSO

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

Copied to clipboard