making remote git storage work [was Re: Subsurface ans Dropbox]
dirk at hohndel.org
Wed May 27 16:36:09 PDT 2015
On Wed, May 27, 2015 at 10:20:45AM -0700, Linus Torvalds wrote:
> On Wed, May 27, 2015 at 10:05 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
> > Even given that libgit2 uses libssh2 it should still be possible to craft
> > a way to communicate with a server and keep a repository synced with that
> > server...
> I actually spent some time trying to figure it all out, and literally gave up.
> My .ssh/config file has things like
> host dives
> HostName git.subsurface-divelog.org
> Port 2222
> User git
> IdentityFile ,,,
> to specify the port-name and user name etc. Even *that* kind of
> trivial thing seems to be a major pain with libgit2. But the
> "IdentifyFile" thing is just too painful for words.
> Hardcoding it to just work with github.com and user "git", and
> hard-coding a path to an identity-file (and require that it has no
> password) might be somewhat reasonable. There is rudimentary support
> for things like identityfiles per se in libgit2, it's just that there
> is no integration with normal ssh configurability.
But there is _git_ssh_setup_conn() which parses a full URL with username,
port, everything. So we should be able to set up a URL like
"git at git.subsurface-divelog.org:2222/reponame"
and then from reading more of the code it calls
which appears to support public/private key authentication.
What am I missing with this proposed flow:
Subsurface has a UI "connect to remote storage"
- asks user for email address
Subsurface connects to our server with that email address and a REST API
returns an encrypted private key
The server sends a PIN to the given email address
- next Subsurface asks for the PIN (and asks if it should store that in
- with the PIN it decrypts the private key
- now using the infrastructure mentioned above it should be able to push /
pull the remote data file
When you add a new instance of Subsurface (on Android, or on a different
computer), you simply enter the same email address and pin, it once again
gets the encrypted private key via the rest api, the pin is entered in the
No configration file magic, no one ever mentions that this is git, it's
all just a remote storage that is accessed with email and pin.
> That said, even then I don't really know how to specify how to try to
> connect and give up quickly if not connected (or if just really slow
> connection). That doesn't seem to be a libgit2 usage model.
That I don't know. Let's work on that once we figure out if my proposed
flow would work (and who volunteers to implement this).
More information about the subsurface