Install
openclaw skills install gitlab-skillGitLab operations including creating and cloning repositories, listing projects, managing issues, merge requests, branches, commits, and pipelines. Use this skill for creating/cloning GitLab repos, browsing projects, creating/updating issues and MRs, and any GitLab API interaction. Supports both API operations and git operations.
openclaw skills install gitlab-skillThis skill enables comprehensive GitLab operations including creating and cloning repositories, listing projects, managing issues, merge requests, branches, commits, pipelines, and more.
The GitLab skill uses a secure, layered credential management system. Credentials are loaded in the following priority order:
Set GitLab credentials as environment variables:
export GITLAB_HOST="https://gitlab.example.com"
export GITLAB_TOKEN="glpat-your-token-here"
Benefits:
Generating a GitLab Access Token:
api - Full API accessread_repository - For repository operationswrite_repository - For creating branches, commits, etc.Persistent Configuration: Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export GITLAB_HOST="https://gitlab.example.com"
export GITLAB_TOKEN="glpat-your-token-here"
Create a configuration file in your home directory:
mkdir -p ~/.claude
cat > ~/.claude/gitlab_config.json << 'EOF'
{
"host": "https://gitlab.example.com",
"access_token": "glpat-your-token-here"
}
EOF
chmod 600 ~/.claude/gitlab_config.json # Restrict file permissions
Location: ~/.claude/gitlab_config.json
Benefits:
If credentials are not found in environment variables or config files, the skill can prompt for credentials interactively (when the --allow-prompt flag is used):
python3 scripts/gitlab_api.py projects --allow-prompt
Note: This is not recommended for automation or CI/CD pipelines.
The skill loads credentials in this order (first match wins):
GITLAB_HOST, GITLAB_TOKEN) - Highest Priority~/.claude/gitlab_config.json)scripts/config.json - deprecated, shows warning)--allow-prompt flag is used)An example configuration template is available at scripts/config.example.json:
{
"host": "https://gitlab.example.com",
"access_token": "glpat-your-token-here"
}
DO:
✅ Use environment variables for production systems
✅ Store user config in ~/.claude/gitlab_config.json
✅ Restrict file permissions: chmod 600 ~/.claude/gitlab_config.json
✅ Use different tokens for different environments
✅ Rotate tokens regularly
DON'T:
❌ Commit credentials to version control
❌ Store real tokens in scripts/config.json
❌ Share access tokens in chat logs or output
❌ Use the same token across multiple environments
❌ Print or log access tokens
For internal GitLab instances with self-signed certificates, use the --insecure flag:
python3 scripts/gitlab_api.py projects --insecure
This bypasses SSL certificate verification (useful for development/testing but not recommended for production).
Test that credentials are configured correctly:
# Test using credential loader directly
python3 scripts/credential_loader.py --show-source
# List projects to verify API access
python3 scripts/gitlab_api.py projects
# Check which credential source is being used
python3 scripts/gitlab_api.py projects --allow-prompt
Problem: "GitLab credentials not configured"
Solutions:
echo $GITLAB_HOST $GITLAB_TOKENcat ~/.claude/gitlab_config.jsonProblem: "Authentication failed (401)"
Solutions:
api, read_repository, etc.)glpat-)curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" "$GITLAB_HOST/api/v4/user"
Problem: "Resource not found (404)"
Solutions:
python3 scripts/gitlab_api.py projects to list accessible projectsIf you have an existing scripts/config.json file:
Immediate Action: Move credentials to secure location
# Export to environment variables
export GITLAB_HOST=$(jq -r '.host' scripts/config.json)
export GITLAB_TOKEN=$(jq -r '.access_token' scripts/config.json)
# Or move to user config
mkdir -p ~/.claude
cp scripts/config.json ~/.claude/gitlab_config.json
chmod 600 ~/.claude/gitlab_config.json
Replace config.json with placeholder:
cat > scripts/config.json << 'EOF'
{
"_comment": "This file is deprecated",
"host": "https://gitlab.example.com",
"access_token": "glpat-your-token-here"
}
EOF
Verify new configuration works:
python3 scripts/credential_loader.py --show-source
python3 scripts/gitlab_api.py projects
When the user wants to create a new GitLab repository:
/api/v4/projects endpoint with the provided parametersinitialize_with_readme: Create repository with initial READMEdefault_branch: Set default branch name (defaults to "main")wiki_enabled: Enable wiki (defaults to true)issues_enabled: Enable issues (defaults to true)merge_requests_enabled: Enable merge requests (defaults to true)jobs_enabled: Enable CI/CD pipelines (defaults to true)Example output format:
## ✅ Repository Created Successfully
**Project**: my-project
**Project ID**: 123
**Visibility**: Private
**URL**: [View Project](https://gitlab.example.com/username/my-project)
**Clone**: `git clone https://gitlab.example.com/username/my-project.git`
Error handling:
When the user wants to clone a GitLab repository:
config.jsonExample workflow:
User: "clone https://gitlab.example.com/group/project to ./myproject"
Action:
1. Extract host (gitlab.example.com) and project path (group/project)
2. Run git clone with authentication
3. Confirm: "✅ Cloned to ./myproject"
Authentication note: For private repos requiring HTTPS auth, embed token in URL: https://oauth2:TOKEN@host/project.git
When the user wants to see their GitLab repositories:
config.json/api/v4/projects)membership=true to show only projects the user is a member ofupdated_at descending to show recently updated projects firstExample output format:
## Found 25 GitLab Projects
| Name | Visibility | Last Updated | URL |
|------|------------|--------------|-----|
| group/project-name | Public | 2025-04-02 | [View](https://gitlab.example.com/group/project-name) |
...
When the user wants to search for specific projects:
/api/v4/projects endpoint with search=<query> parametervisibility=public|private|internal)When the user asks about a specific project:
/api/v4/projects/:id endpoint (project ID or path-encoded URL)List issues:
/api/v4/projects/:id/issues for project-specific issues/api/v4/issues for all issues across projectsCreate issue:
/api/v4/projects/:id/issuesGet issue details:
/api/v4/projects/:id/issues/:issue_iidUpdate issue:
/api/v4/projects/:id/issues/:issue_iidList merge requests:
/api/v4/projects/:id/merge_requests for project-specific MRs/api/v4/merge_requests for all MRs across projectsCreate merge request:
/api/v4/projects/:id/merge_requestsShow MR details:
List branches:
/api/v4/projects/:id/repository/branchesCreate branch:
/api/v4/projects/:id/repository/branchesDelete branch:
/api/v4/projects/:id/repository/branches/:branchList commits:
/api/v4/projects/:id/repository/commitsShow commit details:
/api/v4/projects/:id/repository/commits/:shaList pipelines:
/api/v4/projects/:id/pipelinesShow pipeline details:
When encountering errors:
Authentication failed (401/403):
config.json or generating a new token with appropriate scopesProject not found (404):
Rate limiting (429):
Network errors:
Invalid parameters:
For endpoints that return paginated results:
x-total-pages headerFor complex operations requiring multiple steps:
User asks: "Show me my open merge requests"
Action:
/api/v4/merge_requests?state=openedUser asks: "Create an issue in myproject about the login bug"
Action:
User asks: "What's the status of the main branch in project-group/webapp?"
Action:
PRIVATE-TOKEN header