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
3
votes
3 answers

Would there be anyway to know the origin account's username that ssh'ed into the server?

I initially git cloned a repo, when I push my work, within the post-receive hook, I would like to retrieve the origin acount's username who did the push. I know $SSH_CONNECTION and $SSH_CLIENT give me the origin IP, but I can't find a way to get the…
Spredzy
  • 955
  • 8
  • 11
3
votes
2 answers

GIT Website Deployment

I am attempting to setup GIT to deploy my project to different locations based on the branch. (I think this is what I want to do anyway). My current setup is this: Local dev machine running Netbeans to make changes. Remote server hosting…
Brian
  • 310
  • 2
  • 9
3
votes
2 answers

Installing Git on Ubuntu 12.04

I installed git with gitolite on my vserver using this tutorial. But I've got a problem to clone the gitolite-admin repo to my computer. The user is created with the option --disabled-password But if I try to clone with git clone…
Sven Jung
  • 179
  • 2
  • 8
3
votes
1 answer

Errors while trying to install gitolite

I'm trying to get up and running gitolite as the instructions said at this http://sitaramc.github.com/gitolite/qi.html but when I run the command: [git@devserver gitolite]$ src/gitolite install -ln FATAL: errors found before logfile could be…
ReynierPM
  • 700
  • 5
  • 14
  • 28
3
votes
1 answer

What are the dangerous operations that need to be prohibited on a hosted git repository?

I am looking into the tools neccessary to give other people write access to a git repository. I understand that git repositories are accessed using SSH with a locked-in command like gitosis or gitolite. I learned that git, unlike Subversion, which…
AndreKR
  • 523
  • 1
  • 3
  • 16
3
votes
1 answer

Git/LDAP Accounts/Gitolite

I have relatively little knowledge about what exactly LDAP is and how it works except that I know I can use my LDAP account username/password to log into multiple linux servers. Right now we are using mercurial for version control however I am…
ryanzec
  • 131
  • 5
3
votes
7 answers

aliasing "git" ssh login to "gitolite"

I'm installing gitolite from CentOS packages for my client. The package creates a gitolite user, which will be visible explicitly during a "git clone" operations. The client wants to use "git" and not "gitolite", in case we change to something…
Randal Schwartz
  • 395
  • 1
  • 9
3
votes
3 answers

ssh hostname returns “Bad owner or permissions on ~/.ssh/config” (chmod 600 not working with MingW)

This question is a near duplicate of Robert's question but after trying chmod 600 ~/.ssh/config I still have the same error. I've tried using cygwin and MINGW32 to do the chmod 600. ls -la returns -rw------- on cygwin and returns -rw-r--r-- on…
user29600
  • 399
  • 5
  • 16
  • 29
3
votes
4 answers

Couldn't find package gitolite on Ubuntu 10.04

I've been following this tutorial and I'm stuck on sudo apt-get install gitolite with the error Couldn't find package gitolite I've been Googling around for a while now, no one else seems to have this problem so it's probably a trivial matter...…
user29600
  • 399
  • 5
  • 16
  • 29
2
votes
1 answer

Make Gitolite retrieve ssh keys from LDAP

I think I have some understanding problems with what I want to achieve... So, let's start with what's currently working (all described servers are running CentOS 7) : an OpenLDAP server which contains users' public keys a "data" server running an…
zrtYouyou
  • 21
  • 3
2
votes
2 answers

Git - what is causing "warning: Negative patterns are ignored in git attributes"

When pushing on my server the post-receive hook runs a git clone command. The command returns the following warning and I don't know what it means or how to resolve it. Googling the error gave only results concerning gitattributes and I haven't…
Theo
  • 143
  • 1
  • 11
2
votes
1 answer

Hosting redmine server using apache2 in ubuntu

I am trying to run redmine+gitolite server using apache in an Ubuntu machine. I followed the instructions given here with the following server config file: ServerName redmine.xyz.com ServerAdmin someone@somewhere …
hjpotter92
  • 660
  • 1
  • 10
  • 20
2
votes
1 answer

gitolite to allow users already present in authorized_keys file

I'm using gitolite to restrict the permission on a repository and it has worked well so far until I tried to clone and push with a user whose public key is already added in authorised_keys, not via gitolite. I think the problem is that I'm using the…
rhee
  • 41
  • 2
2
votes
1 answer

gitlab: How to not break old gitolite urls

I'm in the process of migrating from gitolite to gitlab. My original repositories had urls like: git@dev.example.com:project-gui and git@dev.example.com:project-libs. Gitlab has forced me to use urls like: git@dev.example.com:project/gui and…
nishantjr
  • 241
  • 2
  • 9
2
votes
1 answer

Password prompt for public git repositories with git daemon - gitolite

I try to setup a git server with gitolite and make some repositories public. I installed gitolite, configured it for the user git and everything works fine. Permissions and UMask are set to 0027, to allow redmine to read within git…