Show HN: Encrypted Git hosting should be easy
github.com
github.com
Anyone who needs to interact with the source code needs access to the plaintext version (employees, contractors, CodeClimate/CircleCI/Atlassian/Slack/etc type vendors, etc, all retain access), and people who don't need to interact with the source code should have their access removed in the first place.
This only protects you against a malicious/compromised hosting provider, but usually the hosting provider does more than just hosting, they have their own CI/CD features which need access to code. If you don't want the hosting provider to have access then you might be better off self-hosting Gitlab rather than dealing with restrictions like remotes can only have 1 branch.
In the increasingly large set of countries without absolute freedoms, such a thing is a given for any hosting provider.
No current country has absolute freedoms, except as a fantasy.
Edit: I didn't realise you were the person I responded to. I see what you mean, but I still think it's an important thing to discuss. It just won't be relevant to those people, which I can live with.
- if it's public, it's on github.
- if it's a private company project, it probably already has a home, on github or some other trusted commercial provider with cicd and all the trimmings.
- everything else goes here, as encrypted git bundles on s3.
i previously used git-remote-gcrypt for a long time. recently i've been thinking about how i wish worked with git, cicd, and infra. this is how i'm going to be working with that third bucket from now on.
the first bucket is fine, aside from lock of sha256 support.
the second bucket i'm still thinking about.
my take away from implementing this is that git remote helpers are easy to write and very flexible.
Im happy that there are some alternatives being developed.
this takes an explicit dependency on aws, though all that is needed is:
- (large) object storage with read-after-write consistency (s3)
- (small) object storage with compare-and-swap (dynamodb)
it would be easy to port this to any provider that provides these two kinds of object storage.
compare-and-swap means that multiple concurrent writers can safely collaborate without risk of force pushing over each other.
If you want to make git hosting easy, make a self-contained executable that requires nothing but a bare unix-like environment.
Personally, I rather like:
- https://www.zenko.io/
- https://min.io/
Even if I don't really buy into AWS too much (apart from enterprise stuff), it's good that they went ahead and created a standard for blob storage that other implementations could also benefit from, due to the compatibility with various libraries etc.Of course, there's also reliance on DynamoDB for this project, though that could also probably be swapped out for something else.
Many cloud providers provide an S3-Compatible object-store protocol. There's also open source projects self-hosting your own S3-Compatible object storage.
Swapping out DynamoDB for (say) Redis would also be fairly easy.
The source provided is a few hundred lines of pretty readable Golang.
While I'm not generally a fan of "If you don't like it, submit a PR to fix it" type responses - as a short example of how to implement something like this, it's a pretty decent starting point.
At this point it's basically a standard as many blob storage providers just implement the S3 API.
/giphy shutup and take my money
> Amazon is a world class superior provider, you should definitely trust them.
CCP has entered the chat ...
> git not need the end to end encryption. Especially if you build website in xingjian.
Reminds me a lot of gitaly[0].
Awesome work!
the addition here is a second object store with compare-and-swap semantics making it possible for multiple writers to collaborate safely.
many infra providers have object storage with those semantics, my preference is aws.
Oh that's awesome, I didn't catch the rclone support while skimming the README. rclone is such an excellent piece of software.
> the addition here is a second object store with compare-and-swap semantics making it possible for multiple writers to collaborate safely.
I think I must have misunderstood this point too -- the compare and swap semantics that you want are against dynamodb, right with raw/"dumb" storage on S3?
If I could request one thing it would be some extra interface files with "drivers" for the two concerns which are currently being handled by main.go... The locking mechanism and the raw storage mechanism.
Distilling the interface to these components would make it so easy for someone to come along and implement replacements! For example, one might like to see SQLite, FoundationDB, etc as metadata/synchronization drivers.
If there's a clear interface then it's easy to say "sure, send a commit with the implementation and we'll consider including it!", and leave implementation up to people who want the feature.
> many infra providers have object storage with those semantics, my preference is aws.
Yeah I bet this would work out of the box against other infra providers as well? S3 has basically become the defacto API everyone chases anyway.
compare-and-swap ensures that if two simultaneous pushes happen, only one will succeed. the other will have to pull first before retrying push.
there are actually a lot of providers with s3 and dynamo compatible apis. otherwise, fork and implement new provider! git-remote-CLOUD.
Got also does E2E encryption, but it can additionally encrypt branch names from remote servers. It also handles syncing large files and directories better thanks to an improved data structure.
I use it for plain text accounting and personal notes. It's been working great so far, of course I'm the only user and I don't do concurrent writes.
In theory I think the only files that could get conflicts are the ones in the refs directory.
This does not help the people who want to use git for video hosting since it puts the storage and usage back onto a persons credit card again (tho if you come into a line of credit it may be useful).
Hosting on AWS like this does not match the dark web requirements for hiding in plain sight and not easily killable. To spread this over multiple aws accounts and s3 buckets alone would need some form of sts cross linking for the permissions to allow pushing to be granted.
Can you provide a business use case or scenario this would be useable. Else it will continue to have the smell of 'resume driven development'.
To block force push, would also suggest that branch deletion would not work either. Is that the case?
there is no business use case for this, unless your threat model needs an untrusted git provider and you don't have another way to enable that.
perhaps you could store your dotfiles or other backups with this.
Am I missing something?
The hard part is solving the "lost my yubikey" UX issue but I suspect Apple will reach a reasonable solution that finds an OK balance of convenience and user-authenticating security.
lost my yubikey is somewhat covered by the popularity of crypto. recommend users to backup fido2 secrets as bip39 mnemonics.
ios and android will hopefully help popularize fido2.
For years, across two different jobs we just had bare repos on Linux servers - we used git's built in ssh support and we liked it. Worked great. We wanted a Pull Request workflow and moved to GitHub, but self hosted is fine.
All you really need is a server your developers can SSH into with a shared directory. $2 a month Vultr server and you're golden.
You want to get real spicy, you can just do this without a central server at all, The way God and Linus intended. git was designed to be decentralized. You don't even need to share the server, you can just pull from each other's repos if you give each other your SSH access to each other's repos.
afaik it's not possible to have an untrusted git server, at a minimum ram contents will be plaintext.
before i undertook this, i had never heard of git-bundle:
The only thing that's going to remain resident after a push/pull is os level file system cache. There's no daemon when operating git over ssh.
Are container escapes on major hosting services common enough to even worry about? I don't hear much about them.
Or are you concerned about AWS/Vultr/Digital Ocean stealing your code? That seems like paranoia. They have world class developers, best in the industry. They don't want your code. This isn't the movie Antitrust.
which addresses exactly none of what this project is intended to, since there’s no end-to-end encryption. (yes, if you don’t need end-to-end encryption on your git repo, this is too complicated for your use case.)
https://stackoverflow.com/a/377293
git daemon --reuseaddr --base-path=. --export-all --verbose
Others can just pull from the IP address. Works well for hacking in the field, a PR is just one shout away :)