eakkas
eakkas

Reputation: 479

Cannot clone/commit git repository through gitolite/Redmine

I am trying to setup Redmine with gitolite and used this guide http://nsaunders.wordpress.com/2012/04/24/redmine-gitolite-integration/

Everything seems to be working fine, the repository is created through Redmine (I see the repository under gitolite/repositories). However, when I try to initialize the repository with the following commands, I keep getting the same error message

mkdir nwi
cd nwi
git init
touch readme.txt
git add readme.txt
git commit -m 'Initializing T repository'
git remote add origin gitolite@localhost:nwi.git
git push -u origin master

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

The public key for the user is in the autohorized_keys for gitolite. The user is in gitolite.conf for the repository that I am trying to commit to. I am new to git, tried one thousand things and could not get it to work. What can be wrong?

Upvotes: 2

Views: 1252

Answers (2)

Toshe
Toshe

Reputation: 786

  1. generate your own keypair. As your own user execute

    cd ~/.ssh
    ssh-keygen -t rsa username
  2. Make sure that your public key (username.pub) is uploaded in the gitolite /keydir folder. Since you've bundled redmine with gitolite that probably means that redmine is managing these public keys and you would need to upload them to Redmine, so that Redmine can update the admin-repository. Please note that you cannot add keys manually, you'll need to commit and push them through the admin-repository (redmine should do that in your case)

  3. Once your public key is registered in gitolite, try registering your own key in the system:

    exec ssh-agent bash
    ssh-add ~/.ssh/private-key-name

Try connecting again

Upvotes: 1

larsks
larsks

Reputation: 311258

This is an ssh authentication problem more than a git problem. You would typically look in /var/log/secure or similar to see why ssh is rejecting the connection. You want to make sure that:

  • The public key is in the authorized_keys file,
  • The format of this file is correct (no copy-and-paste errors, etc)
  • The permissions on the authorized_keys file are 600 (rw-------)
  • The permissions on the .ssh directory are 700 (rwx------)
  • Everything is owned by the gitolite user

Upvotes: 1

Related Questions