To understand more about git, I try to write a very simple Git server using Python and Flask. I registered an endpoint and redirect the calls to git-http-backend. So far a simple pull works fine. Also simple/small pushes go through.
Now I stumbled over git-upload-pack and git-receive-pack, and I am wondering why or when I would need them? Are they used by git-http-backend
in the background? I am not sure if I additionally have to support these commands too.
P.S. I try to wrap my head around SmartHTTP. Does it mean Full-Duplex? Or what is meant to be SmartHTTP vs Dumb? I don't exactly understand what is supposed to be smart if it also just receives and sends/pushes a file?
I presented the smart http protocol in 2011 with Git 1.6.6.
But
git-receive-pack
andgit-upload-pack
would be involve even without HTTP, with for instance SSH URL.I have to know about them because I often install Git on servers where I am not root.
That means the executable
git
is not in/usr/bin
, but in/my/path/to/git/usr/bin
And whenever I do a
git clone
on my PC from that server (or agit ls-remote
), I get:If I try a
git push
from my PC to that server:That is because, when you look at the
usr/bin
folder of a Git installation, you would see:Meaning
git-receive-pack
andgit-upload-pack
are just symlink togit
itself(!)But, because of their naming convention (
git-xxx
), they are actually callinggit
with the commandreceive-pack
orupload-pack
.(incidently, that works for any script
git-xxx
in your$PATH
: you can then typegit xxx
, that will call yourgit-xxx
script)For my custom Git installation to work, I had to implement
git-xxx
wrappers:Example:
With setenv setting the right PATH:
And on the client (PC) side, I need, for a remote using the server with custom Git installation, to add: