Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8248405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T23:10:48+00:00 2026-06-07T23:10:48+00:00

I have a central git repository which myself and several collaborators regularly push and

  • 0

I have a central git repository which myself and several collaborators regularly push and pull from. In the past I have committed a large binary blob by accident, which requires rebasing to fully delete and is a pain for everyone, so I’d like to protect against this happening in the future. Is it possible to setup a hook in the remote repository that will check the file size of files being pushed (whether they are being added new or an existing file is updated) and reject pushes with files above a threshold size, say 2MB?

Importantly I want existing files already greater than 2MB that are untouched to be tolerated (so a push shouldn’t be rejected if a 2MB file is already in the repository, only if the push adds a 2MB file or grows an existing file to be 2MB). Also, I want the hook to execute on the remote side so I don’t have to worry that clients don’t have to have a hook setup.

Edit: Since a push can contain multiple commits, and even one commit with a large file gets it stuck in the repo, I want to protect against pushes that contain /any commit/ that grows to or adds a >=2MB file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T23:10:50+00:00Added an answer on June 7, 2026 at 11:10 pm

    It sounds like the pre-receive hook would be the correct place for this check. This hook executes on the server side of a push, and has access to enough information for you to implement a file size check.

    This hook is invoked by git-receive-pack on the remote repository, which happens when a git push is done on a local repository. Just before starting to update refs on the remote repository, the pre-receive hook is invoked. Its exit status determines the success or failure of the update.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have Git setup with a central bare repository which is accessed by
I have successfully made, committed, and pushed changes to a central git repository. I
I have several non-bare Git repositories. There is one central Git repository (or at
I have a central Git bare repository. When a push is made to that
I have a central git repository that everyone pushes to for testing and integration,
I have a flash video player which requests a flv file from a central
we have a Git remote repository (in a way, our central repository) on the
I have a server that contains a central git repository and one of my
I have a local git repository a central repo at github. I'm working on
I have recently extracted a few subdirectories from a shared git repository with git

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.