I'm writing a program that can take a Git clone URI and make a clone of the repository on the user's machine. To do this, the program needs to know when it can go ahead with the cloning, and when it needs to give up. The man page for git-clone says that:
Git supports ssh, git, http, and https protocols (in addition, ftp, and ftps can be used for fetching and rsync can be used for fetching and pushing, but these are inefficient and deprecated; do not use them).
How much of this is supported by libgit2?
I know that at the very least they support HTTP, HTTPS and SSH but what about the others?
The SSH Protocol Probably the most common transport protocol for Git is SSH. This is because SSH access to servers is already set up in most places — and if it isn't, it's easy to do. SSH is also the only network-based protocol that you can easily read from and write to.
Git can use four distinct protocols to transfer data: Local, HTTP, Secure Shell (SSH) and Git.
Libgit2 is an alternate implementation of Git, that allows reading and writing to repositories from virtually any programming language through the FFI. Libgit2 is used in Gitaly-Ruby through Rugged, and there's experimental support for it using Git2Go through gitaly-remote .
tl;dr: local, git, ssh, http, https. It does not and has never supported ftp, ftps or rsync.
NOTE: This is all as of v0.23.4.
The list of transport mechanisms libgit2 supports can be found in their "transport" section. These are high level transport algorithms. The particular network protocols are sub-transports.
Of those, we only care about local
and smart
(see transport.c). local
is for local files like file:///home/foo/some_project
. ssh-with-paths
is a wrapper around smart-ssh that lets you explicitly state which programs on the remote to use that you'll probably never use. Anything over the network uses smart
.
The "smart" protocol is one which expects the remote to be more than just a file server. Instead of having to do all the work to determine what objects are needed by requesting files and figuring it all out locally, it can call certain programs on the remote to do that work more efficiently. Here's a discussion of the smart vs dumb protocols.
Which smart network protocols libgit2 supports is in their "smart" section.
You can see this in more detail in transport.c.
As for the deprecated protocols ftp, ftps and rsync, libgit2 does not support them and you can see from their change log they never supported them. Also I don't know if libgit2 will support the dumb protocol.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With