The code which can be found here is a proof of concept showing that using http and websockets as the transport for the smart git protocol is possible and works.
As such performance may be sub-optimal and the code may be unstable at times.
- git
- Python
- websocket-client
- gevent-websocket
At first you should start your gitws server in the directory you want to work with. This can either be a directory containing a repository itself or a directory containing multiple repositories.
For the simple case, let us assume you have cloned this repository to home/user/gitws and you want to publish that one. Change to that directory and run “/home/user/gitws/gitws-server.py”.
For the client to work you need a few pieces in place. First, you need the git-remote-ws binary copied or symlinked to the path holding the git-* binaries (Debian/Ubuntu: ”usr/lib/git-core”). You then need bin/gitws-client somewhere on your path (you could symlink it to usr/local/lib, for example). Do not forget that the gitws Python module needs to be on your PYTHONPATH too.
Once these are in place you can go ahead and run “git clone ws://127.0.0.1:8000/gitws/.git gitws_clone”, which will go ahead and clone your repository over the WebSocket connection. Further calls to git pull, etc. will also use the WebSocket connection.
If you want to know what is going on inside the client go ahead and set the GITWS_LOG environment variable to “debug”.
Done.
Basically gitws operates the same way git’s ssh smart transport works, the only difference is that the communication is carried out via a websocket.
The second approach for this implementation uses a customized git-remote-* binary, which calls gitws-client and lets it do its job.