Gitgitlab¶
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.
-
gitgitlab.cli.
get_gitlab
()¶ 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.
-
gitgitlab.cli.
git
()¶ Git entry point.
-
gitgitlab.cli.
list
(*args, **opts)¶ List the projects owned by the user.
-
gitgitlab.cli.
open
(*args, **opts)¶ Open the project page on the default web browser.
-
gitgitlab.cli.
track
(*args, **opts)¶ Set a gitlab project as remote source.
Authentication¶
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.
Parameters: - 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.
Parameters: - name – Name of the project.
- wiki_enabled – Enable the wiki for this project.
- public – Make the project public.
Return dict: with the created project
-
get_gitlab_remote
()¶ Return the gitlab remote of the repository in the current directory.
Raises NotFound: if the gitlab remote is not found.
-
get_project
(name=None)¶ Return the project with the given name.
Parameters: name – Name of the project to return. Raises NotFound: if the project does not exist.
-
get_project_name
()¶ 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.
-
get_project_page
(name=None)¶ 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.
-
get_projects
()¶ Fetch the projects owned by the user.
Return list: of projects.
-
get_remote
(name)¶ Return the remote with the given name of the repository in the current directory.
-
login
(token)¶ 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.
-
url
¶ Base URL of the GitLab server.
-