Get list of files that are leaving the remote repository via clone, pull, or fetch


I need to create a plugin that intercepts file requests from the client, runs a check on the files in the request via another program and then either allows or rejects the files from being transferred to the user. The operations that this needs to run on is pull, clone, fetch, or similar commands. Basically anytime files are leaving the remote repo. I have not been able to find anything on the forums on this. Any help is appreciated.

Thanks in advance.

That’s not really compatible with how git works.

Best to just assume all files* leave the repository with every clone, pull, fetch. The developer’s repository will grab all versions of all files on each of those operations IF it doesn’t already have them.

[*] - And by “all files” I mean all versions of all files, including all files that have ever been renamed or deleted at any point in the repository’s history!

1 Like

Hi @sylvie,

How can I get a handle to all of these files that are transferred to the user via those commands? I’ve looked into hooks but hooks are to prevent changes from being made to refs. I’ve looked at events as well but I dont think events are what I am looking for as they dont give me access to the content of the files.

Also, is it possible to deny a user the ability to pull files or clone a repo based on some precursor operation?