0

I have gitolite-admin.

Some times our programmers don't use .gitignore file and commit whole directory to the remote repo.

How can I restrict push size in git?

I tried search in git config but unsuccessfully.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167

2 Answers2

1

It has nothing to do with git commit.
You need to set up hooks for this job.

What are some more forceful ways than a .gitignore to keep (force) files out of a repo?

Your hook will check what you want to do and then will decide if to approve the push or not.

In your hook you will have something like this:

# in the hook use this line to get the size of each file
git ls-tree -l

enter image description here

If you want to see the same results in your repository use this:

git ls-tree HEAD -l

How to write hooks:

Here is a nice sample how to attrack attention in hooks:
How to enforce a git commit message policy on local system to prevent pushing

Community
  • 1
  • 1
CodeWizard
  • 128,036
  • 21
  • 144
  • 167
1

You can limit by changed files amount. In your config file:

repo @all
    -   VREF/COUNT/50   = @all
Olga Pshenichnikova
  • 1,509
  • 4
  • 22
  • 47