tyrex
tyrex

Reputation: 8859

How to decrease maximum file size on Git or Github repo?

How can I DECREASE the maximum file size that I can commit onto Git repository (or, at least, that I can push from my remote server onto a Github repository)?

I want to decrease it from the default 50/100MB of Github, to e.g. 10MB. In particular, when I

git commit -m "Message"

I would like Git to warn (or prohibit) me, saying that files x/y/z are too large.

Reason: I don't need to track such big files, but sometimes, accidentally, I forget to .gitignore them and they slow down the "git push" and "git pull" commands, a lot.

1000 thanks in advance.

Upvotes: 2

Views: 835

Answers (1)

VonC
VonC

Reputation: 1323115

This cannot be done on GitHub itself (over which you have no control)

You would need to do that locally, with this (for example) pre-commit hook, in order to check the size of the files part of your commit.
But that means it is a local-only workaround, that needs to be applied on each machine you or your colleagues are working on.

That differs from a private Git repo hosting server, where you can easily limit the size on the listener (an HTTPS one like NGiNX for example, with client_max_body_size )

Upvotes: 2

Related Questions