7 ms·
Browsing a Remote Git Repository
- arjun27 8y agoLooks neat! What happens if you make edits to the files?
- clinta 8y agoIt's an FTP server, and I don't believe it supports PUT, so there is no editing the files.
- gwn7 8y agoIt should return an error message indicating that the files are read-only, obviously.. :)
- begriffs 8y agoYeah, in this server's case it would respond "502 Unimplemented"
- mochja 8y agoI hacked something during the night that supports changes. It creates new commit inside repository for each change. https://github.com/mochja/giftp https://github.com/mochja/giftp
- mikepurvis 8y agoI would love to have some kind of protocol standardized for this. Having done some work on build/packaging tooling for the ROS ecosystem, there are a bunch of cases where we we need to access a metadata file (for dependency resolution) or grab a tarball from a remote repo and end up having to have multiple implementations to handle the slight differences between Github, Gitlab, and Bitbucket, plus a fallback option that actually does a local clone, see: https://github.com/ros-infrastructure/rosdistro/tree/master/src/rosdistro/manifest_provider https://github.com/ros-infrastructure/rosdistro/tree/master/... https://github.com/ros-infrastructure/rosinstall_generator/blob/master/src/rosinstall_generator/distro.py#L144 https://github.com/ros-infrastructure/rosinstall_generator/b...
- gmueckl 8y agoI have hit similar problems multiple times in the past. So I'd be happy if there was a standard git server that is worth its name. SVN did that part right by using WebDAV, so any HTTP client is enough to grab a the contents of a file from there. It is a shame that git doesn't have anything sinilar out of the box almost 20 years later. Even hg has an embedded http that can provide this.
- telotortium 8y agoIs there a generic Git client like gitk or qgit that I can just point to a remote Git URL, like so: `git-client https://github.com/user/repo` https://github.com/user/repo`?
- saagarjha 8y agoMost likely it's just going to clone the thing anyways, so just cd into /tmp and download it there and open it?
- telotortium 8y agoWell, yes, that will work, but many larger Git repos take many minutes to download, not to mention the fact that you now have random repos scattered around your system.
- saagarjha 8y agoYeah, that's mostly why I've learned to find my way around GitHub and GitWeb's UI…I'm not sure if there's any way to implement this without downloading the whole thing.
- alaaibrahim 8y agoIf you are only interested in what HEAD has, you can use `--depth 1` with clone
- telotortium 8y agoYeah, it might just be best to use a script to run `git clone --depth=1` into a temporary directory and run the Git GUI on that checkout. I think I'll try writing that up.
- aepiepaey 8y agoIf you just want to browse/search the source tree in a public project, sourcegraph works great (though it's a web app, not a local application). Just prepend sourcegraph.com/ to the hostname. That'd be https://sourcegraph.com/github.com/user/repo https://sourcegraph.com/github.com/user/repo for your example. It can be self-hosted as well.
- lugg 8y agoBut why? I feel like something went wrong a few steps ago if you find yourself needing this. Happy to be enlightened otherwise? I find it hard to criticize these sorts of projects. I think people should be questioned about strange ideas but over the internet it's hard to convey tone and hard to explain that I still want to encourage them to continue work on the weird, strange and unique.
- throwawayjava 8y agoIn principle, the decentralized nature of git means that you don't really have to do this sort of thing. Just clone and be done. But in practice, I do often find myself browsing my own code on GitHub for a variety of reasons: - I'm in their office at their machine, but didn't bring my laptop. - I'm traveling and want to talk about something with someone (I travel with a separate laptop). - I'm half way through a big refactor and want to go back and see what master looks like. I know how to do this without GH/GL, but the simplest way to do that is to just pull up GH. In all of these cases, and others, it's far easier to just pull up the file on github than it is to clone the repo locally. So, given that we do sometimes want to browse our code remotely, the author then provides the (rather niche) criteria that make this a better solution than GH/GL: "By serving a repo behind an FTP interface, we get these benefits: - Web browser supported but not required - Minimized network traffic, sending just the file data itself - Supported on all platforms, with dozens of clients already written - Support for both the command line and GUI" Agree with you that this is a fairly niche set of criteria, but I could at least imagine myself in an environment where this could be a useful tool.
- gmueckl 8y agoTip for looking up other versions of a file in a local repository when you don't want to update to it: TortoiseGit on Windows can open the repo browser to show the state for a certain commit from the repository history window. Not a lot of people seem to know this. And to this date, I have found no other client with that capability.
- saagarjha 8y agoI do this very often. Usually, I'm looking at a very large project (think glibc, WebKit, etc.) trying to find a certain thing (where is this output coming from, what code path leads to this behavior?); so I really only need to look at a couple of files. It's really not worth cloning the entire project for one little thing.
- nicklaf 8y ago9p: What The Whole World Wants!
- xvector 8y agoI would be much more comfortable with using this if it was written in Go or Rust. Why are we still writing C programs to expose sensitive information when much safer languages exist to handle these?
- begriffs 8y agoAuthor here. I did aim to write the code carefully, for instance doing bounded reads like `fgets(cmd, CLIENT_BUFSZ, conn)` to prevent overflowing my buffer. Also ran the program in Valgrind and exercised different code paths to detect memory leaks and management errors such as use-after-free or double-freeing. Because libgit2 and its memory conventions were new to me, I did actually make mistakes and Valgrind helped me find them. The fix for those mistakes is in commit 59bb39b if you're curious to check it out. Writing in C requires care, but the modern day "rewrite it in rust" crusade does feel overblown. C programs are nice -- small and fast. Anyway, I don't mean to be cocky. A code review is welcome, I'd be curious if I did indeed overlook a security issue.
- gwn7 8y agostagit-gopher can be an alternative too. Lighter than HTML over HTTP, richer than FTP. Example (Gopher link): gopher://bitreich.org/1/scm/stagit-gopher/log.gph
- notaboutdave 8y agoHow is this browsing a "remote" git repository? In the example he clones the remote to a local bare repo first. Am I missing something?
- begriffs 8y agoIn a real scenario gitftp would be run remotely. If you're hosting your own git server then you could host the ftp interface too. It won't work with e.g. Github.
- ken 8y agoI don't know much about the <video> tag, but in Safari I just see a very fuzzy screenshot, leaking off the right edge of the page. Clicking it does nothing, either.
- begriffs 8y ago(Author here) Thanks for reporting this. It looks ok for me in Safari 12.0.3, what version are you on? The bulk of the work is done by Video.js 5.0.2. Perhaps your browser or plugins are blocking the script? Can you send me an email with a screenshot? I do try to make the videos work on every browser if possible.
- ken 8y agoSafari 12.0.2 here. Turned off "uBlock Origin" and it still fails. The console shows "Can't find variable: videojs". I'll send you an email with a screenshot of the whole thing.
- joseph8th 8y agoThis would be really nice in conjunction with Emacs' tramp-mode. I find it annoying using the browser to navigate remote code. I'm curious to try this out!
- newnewpdro 8y agoFun project to hack on, but strikes me as kind of pointless beyond the experience/academic value of making it. There are already a number of read-only FUSE-git bridges, and we already have production-ready FTP daemons galore if that's the protocol you prefer. If you don't like the existing FUSE-git bridges make one of those instead. It's more composable; you could also point apache at the read-only FUSE mount for example. You're unnecessarily tightly-coupling libgit2 and the FTP protocol, and probably creating a bunch of bugs (potentially dangerous RCE ones being a network service) in the process.
- funkaster 8y agothis is really nice! congrats to the author! another frontend that could be interesting: fuse.
- black-tea 8y agoWhy not just allow ssh access? That's what you get by default if you set up remotes without any special Web front end.