GitLab: a merge request blocked by a locked file
GitLab has two kinds of file lock, and each can stop a merge. A merge request that changes a file or directory locked in the GitLab page cannot merge into the default branch (locked_paths, "The files must not be locked by another user."); one that changes a file with a Git LFS exclusive lock held by someone else cannot merge either (locked_lfs_files, "The LFS files must not be locked by another user.") (GitLab docs: file locking, checked November 19, 2026).
The two kinds of lock
- Default branch locks (Premium and Ultimate), set with Lock on a file or directory in the GitLab page. They apply to the default branch only; on other branches everyone can still change the file, and only a Lock status shows. Merge requests that modify a locked file or directory cannot be merged into the default branch.
- Exclusive locks (all tiers), set with Git LFS or
.gitattributeslockable. They apply on every branch.
To see that a lock is what blocks a merge request: Merge Request (MR) Review Inbox for GitLab, a plugin for JetBrains IDEs, lists the merge checks from detailed_merge_status with the blocking ones first.
Whose lock counts
When a merge request that changes locked paths is set to merge, GitLab compares the merge request author with the lock's owner; it does not look at commit authors. The author who holds the lock can merge. A different author is blocked. Because only the author is compared, another user who pushes to the branch of a merge request can change locked files without blocking it. GitLab suggests approval rules that require review, and care over who may push to existing merge request branches.
What to do
- See the locks: Code > Locked files lists both kinds; or run
git lfs locksfor exclusive locks. - Remove a default branch lock: the user who made it, or a Maintainer or Owner, selects Locked on the file or directory and then Unlock file or Unlock directory; or Unlock on the Locked files page. A directory cannot be unlocked while a parent directory is locked, and cannot be locked while something inside it is.
- Remove an exclusive lock:
git lfs unlock path/to/file.png, orgit lfs unlock --id=123, andgit lfs unlock --id=123 --forceto force the unlock. - Renaming an exclusively locked file loses the lock; lock it again under the new name.
- Or ask the lock's owner to open the merge request, or to unlock the file when the work is done.
Locks are also bypassed when a fork is updated from its upstream project, which can overwrite locked files in the fork.
GitLab merge requests in IntelliJ IDEA
Merge Request (MR) Review Inbox for GitLab, a plugin by Lesstep for JetBrains IDEs 2024.1 or later, shows a merge request's merge checks before you merge: approvals, requested changes, unresolved threads, the pipeline, conflicts, and GitLab's other reasons from detailed_merge_status, with the ones that block the merge first, and the head pipeline with a link. The lock reasons are among GitLab's other reasons it lists, so a merge request held up by a lock shows it before you merge. Reading is free; approving, commenting and merging are Pro (US$1.50 a month, with a 30-day trial).
Get it on JetBrains Marketplace
GITLAB is a trademark of GitLab Inc.; IntelliJ IDEA is a trademark of JetBrains s.r.o. This page is not affiliated with or endorsed by GitLab Inc. or JetBrains.
More: GitLab merge refused (405, 409, 422) · GitLab rebase refused or failed (403, 409) · GitLab "The merge conflicts for this merge request cannot be resolved through GitLab" · GitLab "Merge request dependencies must be merged"