Live data from Hacker News

How to Host Your Own Private Git Repositories

eklitzke.org

41–50 of 114 posts

Re: How to Host Your Own Private Git Repositories

#41
Gitlab also can be run in your own server. It actually has an enterprise and an open source version. We use the open source one for a couple of years and it is really great - I recommend it with all my heart.

It has great instructions for installing directly from source and you don't really need to be familiar with ruby to install it. It requires some standard components (web server, database) which should exist on all servers and then you follow the instructions and presto! You have your own gitlab!! It also has great upgrade instructions so you can always be up-to-date.

I know gitlab can also be used through the cloud version (and it even has free private repos) however some organizations feel better if the source code of their projects stay inside the organization.

Re: How to Host Your Own Private Git Repositories

#42
Security question. Can `git-shell` restrict users to their remote home directory? Or if you give me a git shell, can I still do things like `git clone me@example.com:/home/you/secret-sauce` ?

This is only an issue if you're sharing the box and/or remote repositories with other people. For shared remote repositories I've been using the following setup:

1. Create a bare, shared repository at `/var/git/foo`. Configure unix group permissions and the directory setuid bit on it.

2. Give alice access via a `/home/alice/foo -> /var/git/foo` symlink.

3. Set alice's shell to a patched version of the git shell I call `git-home-shell` that sanitizes the repository path argument and makes it relative to her home dir.

Is there a better way these days?

Re: How to Host Your Own Private Git Repositories

#43

Does anyone know of a good AMI or Docker container that's got all this already set up, as far as it's possible? (I know it doesn't look complicated, but if there's a decent "standard" already out there...)

Cloudron.io is easily the best for docker deployments.

Re: How to Host Your Own Private Git Repositories

#44

Does anyone know of a good AMI or Docker container that's got all this already set up, as far as it's possible? (I know it doesn't look complicated, but if there's a decent "standard" already out there...)

I've been quite happy with gitea/gitea.

Re: How to Host Your Own Private Git Repositories

#45
post #16
post #8

This is a good setup if you are the only one accessing the repo. If you need something a little bit more complex, I would highly recommend gitolite for managing repositories & users. Configuration is done via some INI/TOML-like files in a git repo. User public keys are stored in the same repo.

gitolite has amazingly powerful access control, not just per-repo but per-branch or per-directory within a repo. It has very flexible self-service features, if you are OK with remote commands over ssh. Lots of nice scripting hooks. Gitolite home page: http://gitolite.com/gitolite/ I run a multi-tenant gitolite setup for the University of Cambridge: https://git.csx.cam.ac.uk/

Could you point to the documentation regarding per-directory access control? I find the documentation very difficult to navigate and I can't find anything relevant. I'm also not sure how it could work.

Re: How to Host Your Own Private Git Repositories

#46
post #27

Earlier quoted context omitted.

Tried Gitlab: It's incredibly messy. Haven't tried Gitolite. One of my criteria with git repos is the education of new programmers, and I believe starting with a clean, lean UI gave me an initial positive impression that Git was simple (surprising ey?). I won't advertise for the product of my company, but there are a few good UIs around there.

Why do you say it's messy? Would love to get feedback on improvements we can make :)

How many UI designers do you have per developer?

Giving you feedback is a one-off; but the right density of UX designers in your teams and user interviews in your process will teach you much more.

Re: How to Host Your Own Private Git Repositories

#48
post #42

Security question. Can `git-shell` restrict users to their remote home directory? Or if you give me a git shell, can I still do things like `git clone me@example.com:/home/you/secret-sauce` ? This is only an issue if you're sharing the box and/or remote repositories with other people. For shared remote repositories I've been using the following setup: 1. Create a bare, shared repository at `/var/git/foo`. Configure u…

Why not just set standard file permissions (owner and group)?

You could create a group for each repository, and add and remove members as necessary.

Re: How to Host Your Own Private Git Repositories

#49
post #42

Security question. Can `git-shell` restrict users to their remote home directory? Or if you give me a git shell, can I still do things like `git clone me@example.com:/home/you/secret-sauce` ? This is only an issue if you're sharing the box and/or remote repositories with other people. For shared remote repositories I've been using the following setup: 1. Create a bare, shared repository at `/var/git/foo`. Configure u…

Why not just set standard file permissions (owner and group)? You could create a group for each repository, and add and remove members as necessary.

This is precisely what I do.

But, I'd prefer it if git-shell didn't let users probe and read git repositories at any absolute path on the remote end. That's not great behavior for a restricted shell.

Re: How to Host Your Own Private Git Repositories

#50
http://gitblit.com/ is also worth looking into. It is more sophisticated then gitolite (which I also use) and less hairy then gitlab. It is Java based, but doesn't require a database.

Also, for backup, rather then tar up the ".git" directory, I use "git bundle --all" which creates a flat file with all branches included. This file can then be uploaded to GCS or S3.

Post reply on HN