How to reject large clone requests?

While doing GIT clone, Is there any way to restrict cloning of large repo ?
I have requirement where i need to restrict the cloning of repository which have size greater than 2GB.

As in when the repository becomes 2GB - the clone functionality is disabled?

Yes this will also work.

I’m also looking at some code base solution something like hook, where I can check the repository size and restrict cloning if it exceeds threshold limit and allow some exceptional repository to by pass this check.

Awaiting for your response.

You can write a hook plugin to block git clone. See How to create a simple hook in Bitbucket Server | Bitbucket Data Center and Server KB | Atlassian Documentation for more details.