Search code examples
gitsshlocalgitolite

Gitolite create repository with gitolite user locally


I want to create a new repository on my gitolite server with the local account, without accessing through SSH. Is this possible? Are they some gitolite scripts that i can use?

If I try to configure gitolite via the git user on my system by checking out the gitolite-admin repo and configuring it accordingly. But i can't push my changes because the hooks will crash, since i'm not logged in via SSH.

Why do I want to do that? I want to setup gitolite via Chef and create a new repo. But i don't want to provide the private key to the Chef scripts.

Edit

For everyone whos trying to use also chef for setting up gitolite. There is a bug which prohibits naive usage of the bash resource, so you have to specify some environment data explicitly, since gitolite uses them:

bash "gitolite push" do
  cwd "/home/git/gitolite-admin"
  user "git"
  group "git"
  environment ({ 'HOME' => ::Dir.home('git'), 'USER' => 'git' })
  code "../bin/gitolite push"
end

Solution

  • If you are on the gitolite server, one easy solution is to:

    • clone the bare admin repo directly

      cd ~
      git clone repositories/gitolite-admin.git
      cd gitolite-admin/conf
      // Declare a new repo in gitolite.conf
      git add
      git commit -m "New repo"
       ~/bin/gitolite push
      

    The gitolite push is documented here.

    If you really must do it, and this is a one-time thing, you can try gitolite push instead of git push.
    BUT... this defeats all gitolite access control, so if you're going to do this often, maybe you don't need gitolite!