Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid binaries in git commit

Tags:

git

gerrit

I have git integrated with gerrit,
I am trying to stop committing binary files into git,

Here is what I tried:
I added *.bin in .gitignore file,
But that can be skipped using -f option while committing,

Can anyone suggest an alternative method?

like image 553
Syed Avatar asked Dec 22 '25 23:12

Syed


1 Answers

If you really want to prevent any binary to make it to the repo managed by gerrit, you can add a pre-receive hook detecting binaries and rejecting the push: see "Is there a git hook which can prevent binary check-ins".

That way, you still can accidentally commit binaries, but you won't be able to push them to the remote repo.

like image 174
VonC Avatar answered Dec 24 '25 12:12

VonC



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!