| name | gitlab-api |
| description | GitLab API integration for repository operations. Use when working with GitLab repositories for reading, writing, creating, or deleting files, listing projects, managing branches, or any other GitLab repository operations. |
GitLab API
Interact with GitLab repositories via the REST API. Supports both GitLab.com and self-hosted instances.
Setup
Store your GitLab personal access token:
mkdir -p ~/.config/gitlab
echo "glpat-YOUR_TOKEN_HERE" > ~/.config/gitlab/api_token
Token scopes needed: api or read_api + write_repository
Get a token:
Configuration
Default instance: https://gitlab.com
For self-hosted GitLab, create a config file:
echo "https://gitlab.example.com" > ~/.config/gitlab/instance_url
Common Operations
List Projects
GITLAB_TOKEN=$(cat ~/.config/gitlab/api_token)
GITLAB_URL=$(cat ~/.config/gitlab/instance_url 2>/dev/null || echo "https://gitlab.com")
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \