agentleFS
mag1artmag1art/skills/gitlab-basics/SKILL.md

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

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
  1. Very specific:

    Prefer glab for GitLab API/MR actions and normal git for local history, pull, push, branches, and remotes.

    line 29
  2. Distinctive:

    Do not use this skill for GitHub, Bitbucket, or generic git theory without a GitLab operation.

    line 33
  3. Distinctive:

    Do not force-push or modify protected branches unless the user explicitly requests it and the impact is understood.

    line 34
  4. Distinctive:

    Check tools and current auth:

    line 45
  5. Very specific:

    If using a Personal Access Token (PAT), paste it only into the secure glab auth login prompt, never into chat.

    line 69
  6. Distinctive:

    Use a PAT when password login is disabled, SSO/2FA is enabled, or automation needs non-interactive auth.

    line 73
  7. Distinctive:

    Create PAT in GitLab UI:

    line 75
  8. Distinctive:

    Do not print, echo, commit, or paste PAT values into chat/logs.

    line 96
  9. Distinctive:

    Prefer environment variables or password manager copy/paste into prompts.

    line 97
  10. Very specific:

    Use glab auth status for masked verification.

    line 99
  11. Very specific:

    If --ff-only fails, inspect before merging/rebasing:

    line 135
  12. Very specific:

    If glab repo view behaves differently on the installed version, run it from inside the cloned repository after setting the correct remote.

    line 176
  13. Distinctive:

    Create or switch branch:

    line 180
  14. Very specific:

    Create MR with glab:

    line 210
  15. Very specific:

    If push fails with Permission denied (publickey), either configure an SSH key in GitLab or switch remote to HTTPS:

    line 241
  16. Distinctive:

    If prompted for a password over HTTPS, use a PAT instead of the GitLab account password when 2FA/SSO is enabled.

    line 267
  17. Distinctive:

    Do not force-push. Create a feature branch and MR:

    line 277
  18. Distinctive:

    If this is the initial push to an empty project, ask an Owner/Maintainer to adjust branch protection or perform the first push.

    line 285
  19. Very specific:

    Prefer HTTPS if unsure; it usually matches glab auth login credentials.

    line 302
  20. Distinctive:

    Never paste tokens into commands that will be saved in shell history.

    line 303
  21. Very specific:

    Avoid git push --force; use --force-with-lease only when explicitly required and understood.

    line 305
  22. Distinctive:

    Do not push directly to protected main.

    line 306

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 glab flags, also load gitlab-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 status

Login interactively:

# Public GitLab:
glab auth login --hostname gitlab.com

# Company/self-hosted GitLab:
glab auth login --hostname <gitlab-host>

Typical choices:

  • Host: gitlab.com or the company/self-hosted GitLab domain (<gitlab-host>), without the repository path.
  • Protocol for Git operations: choose HTTPS unless SSH keys are already configured.
  • If using a Personal Access Token (PAT), paste it only into the secure glab auth login prompt, 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: glab API 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> --stdin

Security 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 status for 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-only

If --ff-only fails, inspect before merging/rebasing:

git status
git log --oneline --graph --decorate --all -20

Remotes

Inspect remotes:

git remote -v

Add 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>.git

Change 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>.git

Verify project visibility:

glab repo view <namespace>/<repo> --repo <gitlab-host>/<namespace>/<repo> --web=false

If 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 HEAD

For initial repo setup:

git branch -M main
git push -u origin main

Merge Request

Create MR with glab:

glab mr create \
  --source-branch <branch> \
  --target-branch main \
  --title "feat: <short summary>" \
  --description "## Summary
- ...

## Test Plan
- ..." \
  --yes

List MRs:

glab mr list

View current MR:

glab mr view

Common 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 HEAD

Authentication 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 HEAD

Protected 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 --yes

If 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 status succeeds for the intended GitLab host (gitlab.com or <gitlab-host>).
  • PAT, if used, has only needed scopes and was not printed/logged.
  • git remote -v points to the intended project, host, and protocol.
  • git status --short has only expected changes.
  • git pull --ff-only succeeds before pushing to a shared branch.
  • git push -u origin HEAD succeeds 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

  • glab login 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 in glab auth login --hostname, clone URLs, remotes, and PAT UI URLs.
  • Prefer HTTPS if unsure; it usually matches glab auth login credentials.
  • 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-lease only when explicitly required and understood.
  • Do not push directly to protected main; use a branch and MR.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.