Search code examples
gitp2p

Can I create a custom protocol for git?


I'm trying to create Git over P2P. (It's crazy, I know.)

The question is simple: can I create a custom protocol for Git alternative to ssh://, git:// and http://?


Solution

  • Yes, that is definitely possible. Git does support remote helpers for just that. From the git fetch manpage:

    When git doesn’t know how to handle a certain transport protocol, it attempts to use the remote- remote helper, if one exists. To explicitly request a remote helper, the following syntax may be used:

    <transport>::<address>
    

    Further information about remote helpers can be found at the appropriate man page. If that capability is not powerful enough for you (a quick scan suggests it should be), you should remember that git is open source ;).