Comment by 🥬 lamb-duh
The URL needs to point to the .git repository itself. The way you have set up, you would clone from gemini://[URL]/.git/ instead of from gemini://[URL]
I would recommend using git push (over ssh or local filesystem) to a new git repository, instead of copying the .git directory.
The workflow would be something like this:
On the server:
$ mkdir /path/to/hosted/repo
$ cd /path/to/hosted/repo
$ git init --bare
$ mv hooks/post-update.sample hooks/post-update
The --bare on git init means that all the git files go here, instead of in a .git directory. The post-update hook is used to run the command `git update-server-info` when necessary, which creates the index files that are needed when fetching over a protocol that doesn't have directory listings.
On the client,
$ cd /path/to/local/repo
$ git remote add remote [NAME] [server-name]:/path/to/hosted/repo
$ git push [NAME] [BRANCH]
The reason to do a push instead of copying all the files is that it will turn many loose objects in the git database into a single file.
---
In order to get a user browsable capsule at the same [URL] that a git repo is hosted at, you need to make [URL]/objects and [URL]/info map into the git repository, any other paths under the URL can map to your capsule pages.
If you're not doing any CGI, you can just link those two files into your capsule directory.
$ cd /path/to/hosted/capsule
$ ln -s /path/to/hosted/repo/objects
$ ln -s /path/to/hosted/repo/info
Jan 19 · 4 months ago
5 Later Comments ↓
🥬 lamb-duh [OP] · Jan 19 at 19:27:
Thank you for calling attention to the prior work. I actually didn't think to look around for it since I haven't yet found a gemini:// link to a git repo. Do you happen to know of any? If not, do you know if there were in the past?
I think I will add a suffix to my repo name so that they can be differentiated.
That tool seems to be built around a different git-remote-helpers capability than I used. That is something that will probably be worth looking into, it might be worth implementing, especially if there are already git repos out there using it.
@lamb-duh Thanks. I tried the workflow you suggested, but it still doesn't work. I get a different error message though. I can paste it if you want, but I guess you'll get the same error yourself if you try `git clone gemini://gemini.thegonz.net/cdg-git/`. I don't think I know of any use of the rust plugin, but that doesn't mean there wasn't any.
🥬 lamb-duh [OP] · Jan 19 at 21:28:
I've pushed an update that fixes the issue. There was a bug that I didn't see before because you have signed commits. I also added checks in a few places (including the first error you got) that will exit with a brief explanation that the URL is not a valid git repository, rather than showing a python stack trace with a meaningless error.
I also fixed an unrelated issue that came up because we have different default branch names. If you are cohosting a capsule at the same address as a git repository you will also need to expose the file HEAD.
@lamb-duh Nice, I could successfully clone with the new version, though I still get a warning:
Exception ignored on flushing sys.stdout:
BrokenPipeError: [Errno 32] Broken pipe
Ooh, I like it! I wonder if source.community might implement this?
Original Post
Git over Gemini — I wrote a git plugin that adds support for [gemini link] URLs. Fetching works over static file hosting, all that needs to be done is run `git update-server-info` on the repository and host the files over gemini. [gemini link] Once you have installed it, try cloning that same URL. There is also support for connecting to a remote git process over the gemini protocol. This gives you all the capabilities of git (not just fetch), but requires special cooperation from the server....