Questions tagged [gitolite]

Gitolite allows you to setup a centralised Git server, with very fine-grained access control and mother powerful features.

Gitolite lets you use a single user on a server to host many git repositories and provide access to many developers, without having to give them real userids on or shell access to the server. The essential magic in doing this is ssh's pubkey access and the authorized_keys file, and the inspiration was an older program called gitosis.

Gitolite can restrict who can read from (clone/fetch) or write to (push) a repository. It can also restrict who can push to what branch or tag, which is very important in a corporate environment. Gitolite can be installed without requiring root permissions, and with no additional software than git itself and perl. It also has several other neat features described below and elsewhere in the doc/ directory.

Gitolite is separate from git, and needs to be installed and configured. So... why do we bother?

Gitolite is useful in any server that is going to host multiple git repositories, each with many developers, where some sort of access control is required.

In theory, this can be done with plain old Unix permissions: each user is a member of one or more groups, each group "owns" one or more repositories, and using unix permissions (especially the setgid bit -- chmod g+s) you can allow/disallow users access to repos.

But there are several disadvantages here:

  • every user needs a userid and password on the server. This is usually a killer, especially in tightly controlled environments
  • adding/removing access rights involves complex usermod -G ... mumblings which most admins would rather not deal with
  • viewing (aka auditing) the current set of permissions requires running multiple commands to list directories and their permissions/ownerships, users and their group memberships, and then correlating all these manually
  • auditing historical permissions or permission changes is pretty much impossible without extraneous tools
  • errors or omissions in setting the permissions exactly can cause problems of either kind: false accepts or false rejects
  • without going into ACLs it is not possible to give someone read-only access to a repo; they either get read-write access or no access
  • it is absolutely impossible to restrict pushing by branch name or tag name.

Gitolite does away with all this:

  • it uses ssh magic to remove the need to give actual unix userids to developers
  • it uses a simple but powerful config file format to specify access rights
  • access control changes are affected by modifying this file, adding or removing user's public keys, and "compiling" the configuration
  • this also makes auditing trivial -- all the data is in one place, and changes to the configuration are also logged, so you can audit them.
  • finally, the config file allows distinguishing between read-only and read-write access, not only at the repository level, but at the branch level within repositories.

Main Features

The most important feature I needed was per-branch permissions. This is pretty much mandatory in a corporate environment, and is almost the single reason I started thinking about writing gitolite.

It's not just "read-only" versus "read-write". Rewinding a branch (aka "non fast forward push") is potentially dangerous, but sometimes needed. So is deleting a branch (which is really just an extreme form of rewind). I needed something in between allowing anyone to do it (the default) and disabling it completely (receive.denyNonFastForwards or receive.denyDeletes).

Some more features - all of them, and more, are documented in detail somewhere in gitolite's doc/ subdirectory:

  • simple, yet powerful, config file syntax, including specifying gitweb/daemon access. You'll need this power if you manage lots of users+repos+combinations of access
  • apart from branch-name based restrictions, you can also restrict by file/dir name changed (i.e., output of git diff --name-only)
  • if your requirements are still too complex, you can split up the config file and delegate authority over parts of it
  • easy to specify gitweb owner, description and gitweb/daemon access
  • easy to sync gitweb (http) authorisation with gitolite's access config
  • comprehensive logging [aka: management does not think "blame" is just a synonym for "annotate" :-)]
  • "personal namespace" prefix for each dev
  • migration guide and simple converter for gitosis conf file
  • "exclude" (or "deny") rights at the branch/tag level
  • specify repos using patterns (patterns may include creator's name)
  • define powerful operations on the server side, even github-like forking

Support

Most installation problems are caused by not knowing ssh. Take a look at this transcript to see how simple it actually is, if your server's ssh daemon is behaving itself. Someone also wrote a tutorial, see here.

If I suspect your problem is an ssh issue, I will probably ignore it. Please learn how gitolite uses ssh and then methodically go through the ssh trouble shooting document. These two documents contain everything I could possibly tell you. I have nothing to add.

Even for other topics, please look through at least the table of contents of at least the numbered documents to see if your question is already answered, before asking.

Security

Due to the environment in which this was created and the need it fills, I consider this a "security" program, albeit a very modest one.

For the first person to find a security hole in it, defined as allowing a normal user (not the gitolite admin) to read a repo, or write/rewind a ref, that the config file says he shouldn't, and caused by a bug in code that is in the "master" branch, (not in the other branches, or the configuration file or in Unix, perl, shell, etc.).

However, there are a few optional features (which must be explicitly enabled in the RC file) where I just haven't had the time to reason about security thoroughly enough. Please read the comments in conf/example.gitolite.rc for details, looking for the word "security".

License

Gitolite is released under GPL v2.

86 questions
2
votes
2 answers

Gitolite3 not writing

I am a bit at world's end here. I want to install gitolite3 smart http over apache. I can successfully pull, but not push (doesn't even give me any errors or notices, not even in any known log). I have disabled selinux until I figure out whats…
Florian Mertens
  • 403
  • 4
  • 9
2
votes
1 answer

Gitolite3 over http selinux permissions

I'm trying to install gitolite3 on Centos6.4. It works, I can ssh and, after some trouble, I can also read, such as clone, through http and httpd. I am re-enabling selinux into permissive mode, that I disabled earlier for better testing, and the…
Florian Mertens
  • 403
  • 4
  • 9
2
votes
0 answers

Gitolite3 push and selinux access failure

I try to install gitolite3 with ssh and http. I have followed largely the official guide at gitolite3, but I am stumbling accross three remaining problems. When I $ git clone http://florian@server/git/testing, this correctly creates the repo. I add…
Florian Mertens
  • 403
  • 4
  • 9
2
votes
0 answers

How to manually edit gitolite config file (running with redmine)

Say I want to manually edit the configuration files of gitolite (conf/gitolite.conf and add keys). What is the correct way to do so? Logged as git on the server, I have tried to clone git@localhost:gitolite-admin, perform my changes, then push. Note…
FabienAndre
  • 121
  • 1
  • 4
2
votes
1 answer

How to set up sshd so that it never asks for a password for a specific user?

I have a dedicated system account named "git" that is managed by gitlab/gitolite. Users connecting to this account always use SSH keys, "git" user doesn't have a password. If users connect without a SSH key or with a mis-configured key, they get…
Petr
  • 501
  • 1
  • 5
  • 13
2
votes
1 answer

New Users are unable to connect to gitolite/git on amazon aws

These are the steps I followed for setting up a new user on gitolite hosted on amazon aws: 1. Installed gitolite (works - I can can connect as admin & add new repos/users) I added a test repo and a new user in the conf file in gitolite-admin. The…
ali haider
  • 1,120
  • 3
  • 15
  • 26
2
votes
1 answer

gitolite mac don't add new user to authorized_keys

I installed gitolite and every thing works fine for me as admin. But when I'd like to add add a new user the new user can't connect to the server. After I looked into the file authorized_keys I saw that the new user wasn't added to the file. During…
crashbus
  • 121
  • 3
2
votes
1 answer

Missing repos in gitweb

Something crazy is happening to me. If you visit http://git.jshawl.com/, you'll see a single repo "testing.git", though if you click on "TXT" in the lower right corner, you can see another repo that is there "wordpress-theme" Also, I know there…
jshawl
  • 297
  • 2
  • 13
2
votes
2 answers

Gitweb document root with gitolite

I'm on Mac OsX, trying to host my own git server. I've got gitolite running perfectly. However, I have a folder called "git" in my Sites directory, such that visiting http://git.example.com points to that directory. How can I get Gitweb's document…
jshawl
  • 297
  • 2
  • 13
2
votes
2 answers

Installation of GitLab ignores ./config/gitlab.yml

I have been trying to install GitLab on CentOS 5.x, but I am stuck now and google's are confusing. I have been following this install guide (currently stuck here) After running bundle exec rake gitlab:app:status RAILS_ENV=production for the secund…
teresko
  • 164
  • 1
  • 10
2
votes
1 answer

Steps to install & configure Git server, stucked .... :(

I've a CentOS 6.2 server and will like to install & configure a Git Server there. I read a lot of documentation at this [1] and [2] for example but I'm stucked because it's a bit complex than SVN Server and have a lot of things to do. I get…
ReynierPM
  • 700
  • 5
  • 14
  • 28
2
votes
2 answers

Cannot clone gitolite 3 gitolite-admin with Tortoisegit on WIndows 7

I've installed Gotolite 3 on my CentOS 6.2 (64-bit) system using yum, and am trying to clone gitolite-admin with Tortoisegit on Windows 7 (64-bit), which I installed with PLink. Tortoisegit just says it's cloning but the progress bar never moves and…
chrysanhy
  • 21
  • 2
2
votes
1 answer

Syntax check cfengine files before updating git repository

I have my cfengine (2 and 3) files in a git repository fronted by gitolite. Users of this repo have a pre-commit hook that will perform syntax/promise checks on the files as needed. This works fine. To protect against someone not having the…
MarkD
  • 123
  • 4
2
votes
1 answer

Gitolite gl-post-init Hook Automation

ANSWER POSTED BELOW I am currently in the process of setting up a local git/development server and have ran into a snag with the gitolite post-hook. To give an overview of what I am currently doing. I have setup a local server which contains a 4TB…
Nick
  • 153
  • 8
2
votes
2 answers

Troubles cloning from a git / gitolite / git-web / git-daemon server (Fatal: 'gitolite-admin.git' does not appear to be a git repository)

Following this tutorial on installing git, gitolite, git-daemon, and git-web I have successfully completed the entire tutorial and actually added projects gitolite; they show up on git web when I go to http://servername/. Now I'm trying to clone…
user29600
  • 399
  • 5
  • 16
  • 29