Git interface

CLI interface for GitGitlab.

gitgitlab.cli.auth(*args, **opts)

Reset the authentication token.

gitgitlab.cli.clone(*args, **opts)

Clone a Gitlab project.

gitgitlab.cli.create(*args, **opts)

Create a Gitlab project and add it as remote.


Return a logged-in instance of the gitlab client.

Authenticate the client. If the authentication fails with an Unauthorized error, ask the user to provide the token again and retry.


Git entry point.

gitgitlab.cli.list(*args, **opts)

List the projects owned by the user.*args, **opts)

Open the project page on the default web browser.

gitgitlab.cli.track(*args, **opts)

Set a gitlab project as remote source.


Gitlab client

Interface to Gitlab and Git.

exception gitgitlab.client.GitlabException

Gitlab error.

exception gitgitlab.client.NotFound

The item looked for was not found.

class gitgitlab.client.GitlabClient(url=None)

Simple Gitlab client.

clone(name, path=None)

Clone a Gitlab project.

  • name – Identifier name of the project to clone.
  • path – Path to clone to (deufaults to the project name).
create_project(name, wiki_enabled=False, public=False)

Create a project.

  • name – Name of the project.
  • wiki_enabled – Enable the wiki for this project.
  • public – Make the project public.
Return dict:

with the created project


Return the gitlab remote of the repository in the current directory.

Raises NotFound:
 if the gitlab remote is not found.

Return the project with the given name.

Parameters:name – Name of the project to return.
Raises NotFound:
 if the project does not exist.

Return the name of the gitlab project that is tracking the repository in the current directory.

static get_project_name_from_url(url)

Extract the project name from the url and return it.

Parameters:url (str) – A project URL.

Return the url of the page of a Gitlab project.

Parameters:name – Name of the project. If not provided, it will use the project name tracking the repository in the current directory.
Returns:Gitlab project page url.

Fetch the projects owned by the user.

Return list:of projects.

Return the remote with the given name of the repository in the current directory.


Login to Gitlab.

Parameters:token – The user’s Gitlab private token.
track(project_name='gitlab', branch='master', remote_name='gitlab', no_push=False)

Set a gitlab repository as remote for the current git checkout.

Returns:The gitlab git remote.

Base URL of the GitLab server.