47 responses to “Gitolite Installation Step-By-Step”

  1. Dakiss

    Good tutorial, clear, effective. Thank you!

  2. Roger Ivy

    Thanks for this Phil … I’m testing it end-2-end.

    In the initial hardware section, where you wrote “fresh install of “Ubuntu 12.04 LTS 64bit” with root user setup and ssh access to the root user via password”

    I was under the impression that Ubuntu only gives you access to root via “sudo”, that you can’t actually be “root”. Did you set up your initial user as “root”?

    …or did you do something like this:
    sudo passwd
    Password:
    Enter new UNIX password:
    Retype new UNIX password:

  3. Warren Le

    “You used a key that is already set to give you shell access. You cannot use the same key to get shell access as well as access gitolite repos.” (http://sitaramc.github.com/gitolite/emergencies.html#ce)

    In our case is ‘sudo mv gitolite.pub /home/gitolite’
    and ‘/home/gitolite/bin/gitolite setup -pk gitolite.pub’

    Which means we used gitolite.pub to get shell access and access to gitolite repos as well.

  4. Sitaram Chamarty

    Phil,

    That’s a very nice and clearly written blog post.

    But the reason I am writing is this: I can’t tell you how much I appreciate the deprecation notice at the top of your older (2010 or so) blog post on this.

    In contrast, I had to badger the owner of a then-popular (but already long obsolete) blogpost on gitosis for a few months before he finally relented and put in a very weak disclaimer. Luckily it’s no longer among the top hits and we no longer get as many people on #git asking for help because they followed that blog and something went wrong.

    So… thanks again for making my life easier.

    regards,

    sitaram

  5. Joey

    Nice and Superb Gitolite tutorial!

  6. jakkudanieru

    No ssh-add ~/.ssh/gitolite.pub ?
    Kind of stuff that save people time isn’t it?

  7. bfn

    I’ve followed the steps, but ssh asks me for a password:

    $ git clone myserver:gitolite-admin
    Cloning into ‘gitolite-admin’…
    gitolite@myadress.com‘s password:

    I never set a password, and if I press “Enter”, it says “Permission denied, please try again”. Any idea? The server is on Debian Squeeze, and the local machine on Ubuntu 12.04.

  8. Geoff Ford

    Thank you very much for this awesome tutorial. The only one I have found that takes you right through the process and actually works at the end!!

    I would just like to add an additional step for anyone wanting to add new users on other workstations as it took me a while to get this bit working correctly (i.e. not asking for a password).

    *Firstly create your keys on the new users machine.
    *Then copy the public key to the keydir folder of the gitolite-admin repo on whichever machine you set up the above steps to administer gitolite from and commit your changes as described above.
    *On the same admin machine edit the conf/gitolite.conf to add your user wherever required and commit your changes again.

    Now it was at this point I ran into problems when trying to clone a repo on to my new user’s machine. I kept getting a prompt for a password for my new user. The solution was to create the following .ssh/config file on the new user’s machine:

    Host gitbox
    Hostname your_hostname_here
    User gitolite
    Port 22
    IdentityFile ~/.ssh/new_user_key

    Note that whilst you still use the new user’s private key in IdentityFile, the magic comes from entering gitolite as the User as it is this username that is used to make the ssh connection that then passes the new_user_key for authentication. This works because when new users are added to gitolite-admin, the public keys are added as additional keys to the gitolite user on the server in .ssh/authorized_keys.

    You can now clone a remote repo to the new user’s machine with the following:

    git clone gitbox:your_repo_name

    Hope that saves a bit of someone’s time :-)

    Thanks

    Geoff.

    1. Javier

      Hi,
      I see the message “remote: Initialized empty Git repository in /home/gitolite/repositories/bigfastblog.git/”
      But… when I my local machine I try to clone this not works :(
      $git clone gitbox:bigfastblog
      ======
      FATAL: R any bigfastblog gitolite DENIED by fallthru
      (or you mis-spelled the reponame)
      fatal: The remote end hung up unexpectedly
      ======

      Ok… In
      vim ~/.ssh/config
      I need add
      @admin = gitolite

      And now works :S

    2. silviu

      thnx alot guys,
      the top quality tutorial from phil and your hint,geoff, saved my day.

      cheers

  9. Fredrik

    Great tutorial! Usually you face some sort of a obstacle following a tutorial, but here everything just worked flawless and you also explained each steps very well. I usually do not reply on tutorials (which i guess is somewhat rude, but here i had to make an exception) Thanks alot!

  10. Oguz Meteer

    Hi Phil,

    Thanks for the clear tutorial. However I’m having some difficulty installing gitolite. The step where you have to execute:

    gitolite/install -to /path/to/home/directory/of/user/gitolite

    gives me a “Permission denied” error. I have not created the gitolite home directory in /home/gitolite, because I’m running a RAID5 mirror on my server, and wanted to place the home directory there. Since I used sudo su – gitolite, I would not have expected this error. Any clues?

  11. chelifero

    Thanks Phil for this tutorial!!!
    But…
    I want use the same user account to admin gitolite and collaborate, so in my machine I’ve the gitolite-admin folder with this conf/gitolite.conf file:

    @admin = user1
    @staff = user1

    repo gitolite-admin
    RW+ = gitolite @admin

    repo testing
    RW+ = @all

    repo test_repository
    RW+ = user1 @admin
    R = @staff

    and this ~/.ssh/config file:

    Host gitbox
    Hostname remote_repo_ip_address
    User gitolite
    Port 22
    IdentityFile ~/.ssh/user1

    When I try to push conf/gitolite.conf file changes, I see at terminal:

    user1@machine1 ~/gitolite-admin $ git push
    FATAL: W any gitolite-admin user1 DENIED by fallthru
    (or you mis-spelled the reponame)

    Instead if I modify ~/.ssh/config file in this way:

    Host gitbox
    Hostname remote_repo_ip_address
    User gitolite
    Port 22
    IdentityFile ~/.ssh/gitolite

    Push is ok, but I can’t work with git as user1. I can’t switch between these file version of file for working.
    What am I doing wrong? Is that possible?

  12. Joe

    Great stuff – explains a lot of what’s happening when trying to access your git repos via gitolite.

    I need some guidance on the ssh side of things.

    I’ve installed Gitolite and Gitlab 5.0 (Mac OS X Mountain Lion Server – 10.8)
    I can see the Gitlab page just fine – and can add and create users, projects, etc. I can then look on the machine under the repositories and satellites directory and see everything is there hunky-dorey….

    The problem is when I try to clone down up push/pull up to a rego. I can not connect for the life of me – and I’m sure it has something to do with how SSH is either configured or what the git account is being set up as when trying to grab from a repo.

    For instance when I do: ssh git@fe77.com (that’s the gitolite machine), I get:

    PTY allocation request failed on channel 0

    (that’s when on the machine and doing it locally – when on another machine and doing that command – I get in).

    Now, this is different than what I should get. I should get a listing of what repos are allowed with their RW+, etc settings.

    I even try : ssh git@fe77.com info

    info: Writing node (dir)Top…
    info: Done.
    File: dir Node: Top This is the top of the INFO tree
    This (the Directory node) gives a menu of major topics.
    Typing “d” returns here, “q” exits, “?” lists all INFO commands, “h”
    gives a primer for first-timers, “mEmacs” visits the Emacs topic,
    etc…

    (and a whole lot of stuff about emacs, etc)…

    Logically, I should get the access rites for repos to Gitolite again – doesn’t happen.

    Then, the coup d’etat:

    www:temp git$ git clone git@fe77.com:gitolite-admin
    Cloning into ‘gitolite-admin’…
    fatal: ‘gitolite-admin’ does not appear to be a git repository
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    And yes, gitolite-admin is there, and I can pull it down via:

    git clone git@fe77.com:repositories/gitolite-admin

    But many sites mention that this is the WRONG way to do this since it bypasses Gitolite then – and yes, that is proven in that after pulling it down that way, I can’t push anything up – too numerous errors to describe.

    So, my question is this: how do I get SSH on this machine to be setup correctly, etc?

    I have my .bashrc configured as such (and I know this is what’s called when I do that ssh call):

    www:~ git$ more .bashrc
    export GIT_EXEC_PATH=/usr/libexec/git-core

    PATH=$HOME/.rvm/bin:$HOME/gitolite/src:$HOME/bin:$PATH # Add RVM to PATH for scripting

    Any pointers or help would be fantastic.

    Thanks.

    Joe…

  13. Lionel Abderemane

    It is really clear Thank you

  14. Getting started with git ← Adm.in Berlin

    [...] During the journey I was inspired by: http://www.bigfastblog.com/gitolite-installation-step-by-step [...]

  15. D Israel

    This is great! However, I think I’m a little unclear about something.

    You create a key for each user, but how does gitolite know which user you are? Do I have to do something else there?

    Thanks again for this.

  16. D Israel

    Oh oh. Is that what the comment (above) from Geoff Ford is about? Just replace the Identity file with the newly created private key (User remains gitolite)?

    Thanks.

  17. Geoff Ford

    ;-)

  18. Ovidiu Visan

    Thank you very much for this tutorial. It worked great!

  19. Amit Dixit

    I did exactly the same as Geoff Ford described to add new user with new workstation.

    My .ssh/config file was as below:

    Host gitbox
    User gitolite
    Hostname new_host_ip
    Port 22
    IdentityFile ~/.ssh/new_user

    But every time it’s ask for password of gitolite user on my machine.
    gitolite@new_host_ip’s password:

    But once I changed the hostname to gitbox, it works fine. The changes I made is as:

    Host gitbox
    User gitolite
    Hostname gitbox
    Port 22
    IdentityFile ~/.ssh/new_user

    I believe hostname should be our local machine or new host that need to add, Can anyone explain to me why it’s happened.

    Thanks,
    Amit Dixit

  20. chinmay hundekari

    Thanks a lot for this article.. I finally managed to set up gitolite.

    But I am not able to commit into a new repository. I added a line in gitolite.conf and i was able to push it and creat a blank repo.
    But then when i try to push with the below command it asks for my password. and i am not able to proceed forward. I am not asked a password while doing a commit on gitolite repository.

    git push –all git@ubuntu3:ABCD

    ubuntu3 is hostname. and ABCD is the repository.

  21. Josivan Souza

    After create a repository following your blog. How can I clone it from a windows wosktation.

    Thanks

  22. Ido

    Hi Phil,

    I followed your blog (Which is great BTW) but I still face permission problem when I try:

    Idos-MacBook-Air:~ idofishler$ git clone amazongit:gitolite-admin.git
    Cloning into ‘gitolite-admin’…
    FATAL: R any gitolite-admin amazongit DENIED by fallthru
    (or you mis-spelled the reponame)
    fatal: Could not read from remote repository.

    Please make sure you have the correct access rights
    and the repository exists.

    I using an EC2 instance – so I suspect something to do with amazon restriction? Any idea about that?

    BR,
    Ido

    1. Ido

      I was able to solve this!

      I soon found that the user you login with let’s call it ‘git’ and the key file name – must be identical.
      In addition I had to edit the /home/git/.gitolite/conf/gitolite.conf file to add add the the user ‘git’ permissions on this gitolite-admin repository. Now it look like so:

      repo gitolite-admin
      RW+ = git

      repo testing
      RW+ = @all

      I also deleted all the other keys form /home/git/.gitolite/keydir
      Then run ‘/home/git/bin/gitolite setup again.

      Thanks again for this wonderful blog post!

  23. Shuaib

    Hi Phil,

    What’s the recommended setup when you want to host the repositories
    directory somewhere other than /home/git on your server?

    Thanks!

  24. Eshwar

    Phil,

    I followed through your article, but i couldn’t clone gitolite:admin repo.
    I have created a user called ‘gitolitee’ as the user ‘gitolite’ is reserved.

    i have created gitolitee & gitolitee.pub and copied to server through
    scp .ssh/gitolitee.pub gitolitee@ubutu:

    then i cloned the repo and installed it. But when i clone admin repo in local machine it is asked for password.

    Could you help me in this.

  25. Mehran

    Hey phil when i run this command.
    git clone gitbox:myserver

    system asks for
    gitosis:myserver’s password:

    I dont know which password …is it password of my server. I tried but it didnot worked.

  26. Shlomit

    Hi,

    Your tutorial is so clear – Thanks,

    I feel something missing or I don’t understand something.
    I have git install and now I add installation of gitolite.
    How git know to go through gitolite?

    Thanks again for this wonderful tutorial.

  27. Shlomit

    It’s me again,
    I saw that even that I change the file conf/gitolite.conf and I run ‘gitolite setup’, when I run ssh to the git server I got the basic conf that came with the gitolite installation.
    How can I refresh the conf file?

    Thanka a lot.

  28. hopsj

    Hello and thank you for your tutorial. One suggestion that may help make things more clear is to use usernames that are not exactly the same as the name of the program. It can be hard for noobs such as myself to interpret the meaning of ‘gitolite’ especially when it appears 4 times in the same command (username, directory, file?) I found Sitaram’s own tutorials to be difficult to follow for this reason as well. I would suggest something like gitadmin to refer to the gitolite user, and real-world names such as bob to refer to individual users.

  29. yewin

    Hi Phil,

    Thank you for your wonderful tutorial.

    But I feel little wrong in my workstation.

    I setting up gitolite server on linux and clone from eclipse windows.
    So I generate SSH key from elipse from windows side.
    Windows > Preferences > General > Network Connections > SSH 2 > Key Management > Generate RSA Key.
    I change the public key name “bob.pub” and copy to my linux server.

    And then I follow the “Everyone gets a key” section as the end of post.
    But I always face the following errors.

    ssh://gitolite@xx.xx.x.xx:22/home/gitolite/repositories/foo.git FATAL: R home/gitolite/repositories/foo bob DENIED by fallthru.(or miss-spelled the repo name)

    I try the numerous repository path.:
    git+ssh://gitolite@xx.xxx.xx:22/foo
    git+ssh://gitolite@xx.xxx.xx:22/foo.git

    It not work and still errors.
    Any suggestion about that??
    I always appreciate your suggestion.

    Thank Again.
    yewin

  30. rballen

    Thanks man! I’ve spent hours going round and round trying to install gitolite. Then I found your article 20 minutes ago and now my pi gitbox is finally working perfectly. Awesome!

  31. Maciej Cygan

    Hello Phil

    I have tested this and it works great. However !
    I am now trying to integrate Gitolite with Redmine and its a pain in the ass and i can not get it to work .. is there a chance that you could amend this / or create new tutorial to show how to integrate gitolite with redmine ? I would really appreciate it !!

    Thanks