6

I'm trying to install git and gitolite for our development in a CentOS linux server. Everything so far has ran ok except the step where I define the admin user for gitolite with this command:

gitolite setup -pk /tmp/id_rsa.pub
FATAL: errors found but logfile could not be created
FATAL: /home/git/.gitolite/logs/gitolite-2013-05.log: No such file or directory
FATAL: die      '/tmp/id_rsa.pub' does not seem to be a valid ssh pubkey file

It looks like two errors; in /home/git/ there's only these files

.gitolite.rc
.bashrc
.bash_profile
.bash_logout

And second (which seems to be the issue), is that the pub_key is not valid. However, according to the git book the file looks alike. I generated it like this:

  1. Installing git in my pc (not the server)

  2. From the git bash:

ssh-keygen.exe
(default path)
(no password)
(no password)

I copied the generated .pub file to the tmp directory on the server via a program named WinSCP.

What I'm I doing wrong? I don't find the answer in google.

PS. If you need more information, please let me know.

Roger
  • 2,912
  • 2
  • 31
  • 39
  • I had problems with Windows-generated RSA keys being too short. At the time, nothing complained, they just didn't work. Maybe someone added a bit of Perl code to check the key length? Make sure you're generating at least 768-bit RSA keys. – torek May 27 '13 at 18:25
  • @torek The key is the exact length of the book's sample. As for the perl code, no, the server was just installed and the key was generated by myself for this purpose, I didn't have the .ssh folder. I'm so lost :(. – Roger May 27 '13 at 18:33

2 Answers2

3

I also ran into this issue and took a look into the sources of gitolite. The code is basically executing

ssh-keygen -l -f yourFile.pub

to verify wheter the file is a valid ssh-public key... On my machine (OpenWRT router) ssh-keygen wasn't installed. Installing it with:

opkg update
opkg install openssh-keygen

fixed the problem for me.

  • Interesting answer, I wouldn't have thought to immediately check for ssh-keygen. +1 – VonC Dec 25 '14 at 22:28
  • Spot on! If using Alpine Linux make sure you install `openssh-keygen` – starfry Sep 29 '20 at 14:27
  • Great! On my install - a dockerized version of gitolite - `ssh-keygen` was present but it was the public key file which was in an incorrect format : surrounded by double quotes. Removing them has solved my issue. – M-Jack Dec 13 '21 at 17:08
1

Make sure the /tmp/id_rsa.pub is exactly like the one you have on your PC, in one line, without any ^M at the end of the line (\n only, not \r\n).

And reading the gitolite setup help page, you should name your public key (on the /tmp of the server) with admin's username.

The first time you run it, you need to have a public key file (usually from the admin's workstation) ready.
If the main gitolite admin's username is "alice", this file should be named "alice.pub". Then, as the hosting user, run:

gitolite setup -pk alice.pub
mroselli
  • 151
  • 5
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @Roger no it can be any name you want. Make sure you generate it like so: http://stackoverflow.com/a/16171741/6309 – VonC May 27 '13 at 19:31
  • How to make a one line public key? Mine has 4-5 lines. – user938363 Sep 26 '13 at 01:30
  • @user938363 are you sure it is over several lines? Or just dispayed in several lines? You can add it to `~/.ssh/authorized_keys` with a `cat key.pub >> authorized_keys`: the key will be copied as one line. – VonC Sep 26 '13 at 06:08