On Monday, December 29, 2014 9:02:19 AM UTC-6, serapath wrote: > > i'm following tim and the js-git project already for a long time... > https://github.com/creationix/js-git > in feature goals here: > https://www.bountysource.com/teams/js-git/fundraiser > it says: > > - Clone remote repositories to local storage over http, git, or ssh. > > The problem here is the protocols allowed by browsers. I have fully implemented clone over https (smart git http protocol), but github refuses to enable CORS headers on their git endpoints or even tell me why they won't turn them on. I've been asking literally for years now. The normal git tcp protocol and ssh protocol require access to raw tcp, which a browser can't do alone.
> > - Make and commit local changes offline. > > Yep, this works great as can be seen in the https://tedit.creationix.com/ website that works 100% in the browser. > - Manage tags and branches offline. > > This also works great, but using low level APIs where the user manually creates the refs and tag objects if the tags are annotated. I highly recommend reading the git internals chapter in the git book to understand how js-git currently works. Most the APIs work at this low level currently. http://git-scm.com/book/en/v1/Git-Internals I have not implemented diff and merge yet, everything works in terms of the git object graph. > > - Push changes back up to remote repositories. > > This is where I got stuck. Since I can't speak any of the git protocols in a browser without involving an external proxy (https://github.com/creationix/git-proxy), I'm not sure how to proceed. There are two major problems with using a proxy. 1. My proxy will act as a man in the middle during your secure conversation with github. I'll be speaking wss (websockets over tls) to the browser and https (http over tls) to the github server, but I'll be providing my own tls credentials to the browser and be able to see all traffic in the clear, including your credentials. I don't want the ability to see someone's github credentials. If the proxy was for read-only clones using the git protocol, it would be fine, except for point #2. 2. My proxy will act as a bottleneck and cost me resources and make your experience dependent on my ability to keep it up. It's simply much better for github to just add the CORS headers so that the browser can speak directly to github. But they won't, so I got stuck here. I ended up running out of time and money and had to work on other paying projects. I did have an idea to implement TLS in the browser in pure JavaScript and letting the proxy only make TCP (without tls) connections. It will still be a bottleneck and point of failure, but the proxy is simple to setup and many people could setup proxies to share the load. Since the encryption would be end-to-end, the proxy in the middle wouldn't be able to see anything. This can probably be done with the forge project combined with my http code. Implementing http on top of a TLS stream in pure javascript is trivial compared to git pack protocol and tls protocol. I even had a crazier idea to implement ssh in pure ssh using the rsa primitives in forge. You could generate ssh private key in your browser, upload it to github using the rest api or manually, and then speak ssh to clone and push using the pure js ssh implementation. But I ran out of time, sorry. > > - Serve git repositories over http, git, or ssh > > I have a couple of proof-of-concepts around this area, but since if you're creating a server, you can already access real git, it was lower priority. One solution is to use the git-fs backend to js-git which uses the same filesystem format as real git. Real git can do the network stuff and js-git will give you a read-write interface to the git repo locally. > is it already possible to checkout a repository from within a browser, say > github, add a commit and push back the changes to github? > Are there any howtos, tutorials or other learning materials around jsgit? > I do have another route using the js-github project. It implements a js-git compatable object, but uses github's proprietary REST APIs to sync the local database with the remote git repos. It's not as efficient and will likely cause you to reach your rate limit real fast if you try to do a full clone since every object is a separate http request. It does, however, enable new workflows where you only download files on demand and treat the remote repo as the local database. In this workflow, there is no clone, but it's more like a nfs or samba mount. > > on nodeschool.io i found https://github.com/jlord/git-it, but it seems to > be just about normal git. > > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/6ad5ec30-f081-4347-ada6-b46447fa5b95%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.