[go: up one dir, main page]

Skip to content

Investigation: Enforcing Git LFS for all users of a project

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

This is an action item from an internal discussion about Git LFS.

When a project is configured to use Git LFS, it also requires configuration of each client machine via .gitconfig settings. There is the possibility that some users will not correctly configure their clients, and then accidentally push large files to the git repo instead of LFS.

Investigation

How can we make sure that users do not accidentally push large files to the git repo instead of Git LFS? Here are some potential paths:

  • configure the project in a way that ensures all clients have the correct Git LFS settings
  • prevent (incorrectly setup) clients from pushing large files to the git repo.

Some thoughts:

Does the routing to Git LFS occur only based on file extension or can file size also be considered?

Problem

  • LFS is configured for a project and its .gitattributes file contains an LFS filter (like *.lfs filter=lfs diff=lfs merge=lfs -text)
  • A user doesn't have LFS config in their .gitconfig and pushes a raw file to GitLab
  • GitLab recognizes that a file with an extension from .gitattributes is fully pushed (instead of it being an LFS pointer) and acts accordingly

Possible solutions

  • We can simply reject such files by default but I'm not sure yet whether it's disruptive
  • We can implement a push rule Enforce Git LFS. Then such files will be rejected if the push rule is enabled.
Edited by 🤖 GitLab Bot 🤖