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.

85 questions
2
votes
1 answer

gitweb- fatal: not a git repository

So I have set up a simple server running debian stable (squeeze), and have configured git. Using gitolite, I have all functionality (at least the basic clone/push/pull/commit) working. Installation of gitweb went without any issues. However, when I…
Robert Mason
  • 139
  • 6
2
votes
2 answers

AWS XFS performance issues. Stripped setup vs single disk setup

I wanted to share an issue (I guess I may be misunderstanding some concepts) that I'm facing with some benchmarks I'm doing to XFS setups, as we are going to recently migrate a service to a new instance and we would like to have the max. amount of…
1
vote
1 answer

gitolite on openwrt - ssh not using gitolite

I've set up a gitolite installation on OpenWrt-18.06.04 according to this guide: https://openwrt.org/docs/guide-user/services/gitolite Step 9 of the "actual install" suggests removing the RSA-key from /srv/git/.ssh/authorized_keys If I do so, I…
goaran
  • 111
  • 1
1
vote
0 answers

How does Github know which user made the commit?

I am trying to write a little GUI for my gitolite server. My plan is to create a hook, which then writes the git log to a database or a file. Then a php file can read this data and display it like the network on github. My problem is now how do I…
Apatus
  • 21
  • 4
1
vote
1 answer

setting up gitolite repository hook

I have set up a gitolite repository specific hook according to the documentation on page http://gitolite.com/gitolite/non-core.html#hooks I have enabled the repo-specific-hooks feature in the .gitolite.rc file. I have created a directory…
sakra
  • 189
  • 1
  • 9
1
vote
1 answer

Is there any limitations as to what can be stored in gitolite-admin?

I know that the gitolite-admin repository contains the gitolite.conf and the keydir directory. Can I add arbitrary files and objects to the gitolite-admin repository without repercussions? Here, I'm specifically looking to preserve the .gitolite.rc…
paulluap
  • 33
  • 4
1
vote
1 answer

Does the Gitolite @all group include the gitolite-admin repo?

In my googling, I've only came across statements that state that @all "includes all users and repos" I'd like to use @all to provide daemon access, that is repo @all R = daemon But I'm concerned that would provide read access to the…
paulluap
  • 33
  • 4
1
vote
1 answer

Deploy app by triggering `git pull` after commit

I have a git repo on a remote server (my own). I want to make sure that after a git push onto that remote server, a new instance of the node program is pulled in the local development server (then, forever will pickup the changes and restart it). At…
Merc
  • 789
  • 1
  • 6
  • 16
1
vote
2 answers

Backing up a complete Git server

I have a CentOs 7.1 and a Git Server installed on it. The Git Server is configured with SSH keys so users need a passphrase and a private key to connect to the server. There are currently 7 repositories, which the users commit to frequently. The…
kiltek
  • 143
  • 1
  • 8
1
vote
1 answer

gitolite git user asking for password with valid keys

My gitolite installation start to ask for password suddendly, I checked the /var/log/secure file and found this. sshd[9071]: User git not allowed because account is locked sshd[9072]: input_userauth_request: invalid user git After a quick search…
Arnold Roa
  • 158
  • 10
1
vote
0 answers

Gitlab add default post-update

we've setup Gitlab (as was described at official site). All works fine. Now we need to add git hook to new-created projects called post-update (lets say it is located at /home/git/gitolite/hook/post-update). I think there is some easy way to use…
MealstroM
  • 1,517
  • 1
  • 17
  • 32
1
vote
0 answers

NGINX and CGit configuration

I?m trying to setup CGit and NGINX. I'm almost there but I have a problem with the rewrite rule in my NGINX's conf file. Currently I have this: server { listen 80; server_name cgit.mydomain.com; index cgit.cgi; gzip off; …
alexandernst
  • 534
  • 3
  • 9
  • 21
1
vote
1 answer

How to setup Git Linux server for Windows domain clients via SSH?

Is this combination possible? Server: Git on Linux Clients: Windows Authentication: Windows domain credentials Transport protocol: SSH If yes how would this be accomplished?
Al Bundy
  • 165
  • 8
1
vote
1 answer

Gitlabhq gitolite update repos and keys issue

I would like update gitolite. But when i start command > sudo -u gitlab -H bundle exec rake gitlab:gitolite:update_repos remote: Counting objects: 1459, done. remote: Compressing objects: 100% (1172/1172), done. Receiving objects: 100% (1459/1459),…
Stepchik
  • 99
  • 4
  • 11
1
vote
0 answers

redmine-gitolite plugin post recieve hook

I have redmine installed with around 12 projects and most of them are websites/web apps. Their code is maintained on the same server using redmine-gitolite-plugin by eric (https://github.com/ericpaulbishop/redmine_git_hosting.git). Till now…
Medhamsh
  • 111
  • 1