Since my work needs, I need to download only the commit object in ./git/objects
from the remote git repository. /.git/
metadata contains some useful information. But in the pack file include the commit/tree/blob object. the tree/blob objects are too large, so the tree/blob object Should not be download. Maybe I need to rebuild the git client or write a python script.
I saw some projects (like https://github.com/lijiejie/GitHack
).It downloading the files step by step by parsing the index
file, and finaly the commit/tree/blob objects are separated after the download.
But this method need to access the .git
folder via HTTP, and you can't download the index file directly from github.
I don't understand how github communicates with the git client.
I tried to look at the underlying source code for C(https://github.com/git/git) and Java(https://github.com/eclipse/jgit), but the complicated structure puzzled me.
Is there any way to implement the function of downloading only the commit object? Or how can I help myself find the key code in the underlying source code.
If you know how to do this, please let me know. thank you very much.
PS: I need to download somefile of .git
from github/gitlab(public Repositories) . But --filter=blob:none
in github recive warning: filtering not recognized by server, ignoring
. And github's api have strong limits.