This post explains how to apply a reference filter to your Git server using
JGit. This might be useful if you want to filter refs, e.g. hide internal refs.
This can be achieved by implementing the interface
implemented, you just need to apply it to your upload-pack factory so that it
can change the upload-pack creation.
If you’re not familiar with Git references, this post will be too difficult for you. I suggest you to first take a look at §10.3 Git Internals - Git References of book “Pro Git”, you’ll get a much better understanding of this subject.
Let’s code. First of all, implement the
Then, include it in your upload-pack factory to change the upload-pack creation.
For example, only takes the public refs
refs/heads/public/.* in the ref
database, and provide them to the client:
At the end, use this upload-pack factory in your
That’s it. Now it should work :)