gitlab-basics
Skill1 starsChanged 3 months agoApache-2.0View on GitHub
Use for everyday GitLab and git operations: authentication, clone, pull, branch, push, merge requests, and permission troubleshooting.
- Deletes or force-pushes
- Commits and pushes
In this repository14 other files it gives its agents.
- aspnet-core-apiSkill
- aspnet-mvcSkill
- blazorSkill
- docker-dotnetSkill
- dotnet-expertSkill
- dotnet-file-based-appsSkill
- dotnet-messagingSkill
- dotnet-observabilitySkill
- dotnet-performanceSkill
- dotnet-testingSkill
- dotnet-version-guideSkill
- efcore-postgresqlSkill
- gitlab-ci-dotnetSkill
- pandocSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 13 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 29
Prefer glab for GitLab API/MR actions and normal git for local history, pull, push, branches, and remotes.
- Distinctive: line 33
Do not use this skill for GitHub, Bitbucket, or generic git theory without a GitLab operation.
- Distinctive: line 34
Do not force-push or modify protected branches unless the user explicitly requests it and the impact is understood.
- Distinctive: line 45
Check tools and current auth:
- Very specific: line 69
If using a Personal Access Token (PAT), paste it only into the secure glab auth login prompt, never into chat.
- Distinctive: line 73
Use a PAT when password login is disabled, SSO/2FA is enabled, or automation needs non-interactive auth.
- Distinctive: line 75
Create PAT in GitLab UI:
- Distinctive: line 96
Do not print, echo, commit, or paste PAT values into chat/logs.
- Distinctive: line 97
Prefer environment variables or password manager copy/paste into prompts.
- Very specific: line 99
Use glab auth status for masked verification.
- Very specific: line 135
If --ff-only fails, inspect before merging/rebasing:
- Very specific: line 176
If glab repo view behaves differently on the installed version, run it from inside the cloned repository after setting the correct remote.
- Distinctive: line 180
Create or switch branch:
- Very specific: line 210
Create MR with glab:
- Very specific: line 241
If push fails with Permission denied (publickey), either configure an SSH key in GitLab or switch remote to HTTPS:
- Distinctive: line 267
If prompted for a password over HTTPS, use a PAT instead of the GitLab account password when 2FA/SSO is enabled.
- Distinctive: line 277
Do not force-push. Create a feature branch and MR:
- Distinctive: line 285
If this is the initial push to an empty project, ask an Owner/Maintainer to adjust branch protection or perform the first push.
- Very specific: line 302
Prefer HTTPS if unsure; it usually matches glab auth login credentials.
- Distinctive: line 303
Never paste tokens into commands that will be saved in shell history.
- Very specific: line 305
Avoid git push --force; use --force-with-lease only when explicitly required and understood.
- Distinctive: line 306
Do not push directly to protected main.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitLab Basics
Overview
Compact GitLab workflow for day-to-day repository work. GitLab may be hosted at gitlab.com or at a company/self-hosted address such as gitlab.company.com, git.example.org, or https://gitlab.internal. Treat the host as a variable: <gitlab-host>.
Prefer glab for GitLab API/MR actions and normal git for local history, pull, push, branches, and remotes.
When Not to Use
- Do not use this skill for GitHub, Bitbucket, or generic git theory without a GitLab operation.
- Do not force-push or modify protected branches unless the user explicitly requests it and the impact is understood.
When to Use
- User asks how to authenticate with GitLab.
- Need to clone, pull, push, set remotes, or open a merge request.
- Need a quick checklist before changing a GitLab repository.
- For protected branches, initial push issues, or version-specific
glabflags, also loadgitlab-glab-workflow.
Auth
Check tools and current auth:
command -v git
git --version
command -v glab || true
glab --version 2>/dev/null || true
glab auth statusLogin interactively:
# Public GitLab:
glab auth login --hostname gitlab.com
# Company/self-hosted GitLab:
glab auth login --hostname <gitlab-host>Typical choices:
- Host:
gitlab.comor the company/self-hosted GitLab domain (<gitlab-host>), without the repository path. - Protocol for Git operations: choose
HTTPSunless SSH keys are already configured. - If using a Personal Access Token (PAT), paste it only into the secure
glab auth loginprompt, never into chat.
Personal Access Token (PAT)
Use a PAT when password login is disabled, SSO/2FA is enabled, or automation needs non-interactive auth.
Create PAT in GitLab UI:
- Public GitLab:
https://gitlab.com/-/user_settings/personal_access_tokens - Self-hosted/company GitLab:
https://<gitlab-host>/-/user_settings/personal_access_tokens
Common scopes:
read_repository: clone/fetch/pull private repos.write_repository: push over HTTPS.api:glabAPI actions such as repo view, merge requests, pipelines, protected branches.
Recommended default for normal glab + git work: api, read_repository, write_repository with the shortest practical expiration.
Non-interactive login, if the PAT is already in an environment variable:
printf '%s' "$GITLAB_TOKEN" | glab auth login --hostname <gitlab-host> --stdinSecurity rules:
- Do not print, echo, commit, or paste PAT values into chat/logs.
- Prefer environment variables or password manager copy/paste into prompts.
- Rotate/revoke the PAT immediately if exposed.
- Use
glab auth statusfor masked verification.
Clone / Pull
Clone HTTPS:
# Public GitLab:
git clone https://gitlab.com/<namespace>/<repo>.git
# Company/self-hosted GitLab:
git clone https://<gitlab-host>/<namespace>/<repo>.git
cd <repo>Clone SSH, only if SSH key is configured in GitLab:
# Public GitLab:
git clone git@gitlab.com:<namespace>/<repo>.git
# Company/self-hosted GitLab:
git clone git@<gitlab-host>:<namespace>/<repo>.git
cd <repo>Pull latest changes:
git status --short
git branch --show-current
git pull --ff-onlyIf --ff-only fails, inspect before merging/rebasing:
git status
git log --oneline --graph --decorate --all -20Remotes
Inspect remotes:
git remote -vAdd origin:
# Public GitLab:
git remote add origin https://gitlab.com/<namespace>/<repo>.git
# Company/self-hosted GitLab:
git remote add origin https://<gitlab-host>/<namespace>/<repo>.gitChange origin:
# Public GitLab:
git remote set-url origin https://gitlab.com/<namespace>/<repo>.git
# Company/self-hosted GitLab:
git remote set-url origin https://<gitlab-host>/<namespace>/<repo>.gitVerify project visibility:
glab repo view <namespace>/<repo> --repo <gitlab-host>/<namespace>/<repo> --web=falseIf glab repo view behaves differently on the installed version, run it from inside the cloned repository after setting the correct remote.
Commit / Push
Create or switch branch:
git checkout -b feat/<short-name>
# or: git switch -c feat/<short-name>Commit:
git status --short
git add <files>
git commit -m "feat: <short summary>"Push current branch:
git push -u origin HEADFor initial repo setup:
git branch -M main
git push -u origin mainMerge Request
Create MR with glab:
glab mr create \
--source-branch <branch> \
--target-branch main \
--title "feat: <short summary>" \
--description "## Summary
- ...
## Test Plan
- ..." \
--yesList MRs:
glab mr listView current MR:
glab mr viewCommon Fixes
SSH permission denied
If push fails with Permission denied (publickey), either configure an SSH key in GitLab or switch remote to HTTPS:
# Public GitLab:
git remote set-url origin https://gitlab.com/<namespace>/<repo>.git
# Company/self-hosted GitLab:
git remote set-url origin https://<gitlab-host>/<namespace>/<repo>.git
git push -u origin HEADAuthentication failed over HTTPS
Refresh login:
glab auth status
# Public GitLab:
glab auth login --hostname gitlab.com
# Company/self-hosted GitLab:
glab auth login --hostname <gitlab-host>If prompted for a password over HTTPS, use a PAT instead of the GitLab account password when 2FA/SSO is enabled.
git pull --ff-only
# or
git push -u origin HEADProtected branch rejects push
Do not force-push. Create a feature branch and MR:
git checkout -b feat/<short-name>
git push -u origin HEAD
glab mr create --target-branch main --fill --yesIf this is the initial push to an empty project, ask an Owner/Maintainer to adjust branch protection or perform the first push.
Verification Checklist
glab auth statussucceeds for the intended GitLab host (gitlab.comor<gitlab-host>).- PAT, if used, has only needed scopes and was not printed/logged.
git remote -vpoints to the intended project, host, and protocol.git status --shorthas only expected changes.git pull --ff-onlysucceeds before pushing to a shared branch.git push -u origin HEADsucceeds and sets upstream.glab repo view ...can see the project on the intended host; for self-hosted GitLab, verify from inside the repo or pass the host-aware repo selector.- MR exists if work should be reviewed before merge.
Pitfalls
glablogin does not make SSH work unless SSH keys are configured.- GitLab is not always
gitlab.com; check the actual company/self-hosted host and use it consistently inglab auth login --hostname, clone URLs, remotes, and PAT UI URLs. - Prefer HTTPS if unsure; it usually matches
glab auth logincredentials. - Never paste tokens into commands that will be saved in shell history.
- A PAT is equivalent to a password for its scopes; use short expiration, least scopes, and rotate it if exposed.
- Avoid
git push --force; use--force-with-leaseonly when explicitly required and understood. - Do not push directly to protected
main; use a branch and MR.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

