Search code examples
gitgitosis

Gitosis installation error


I am trying to install gitosis on my server but keep getting the error "Username contains not allowed characters"

sudo -H -u git gitosis-init < /tmp/id_rsa.pub

with the username "[email protected]".

Any fix for this?

I am on a Mac and trying to install gitosis on Snow Leopard.

Update

I changed the username in the public key to [email protected] and it worked. Probably it's a problem with the hyphen sign. After installing I tried this

git clone [email protected]:gitosis-admin.git
cd gitosis-admin

but it fails saying

fatal: 'gitosis-admin.git': unable to chdir or not a git archive

Any ideas about what I may be doing wrong?

This is the guide I followed: http://nfocipher.com/index.php?op=ViewArticle&articleId=12&blogId=1


Solution

  • Is this related to the public key format, as described in this thread?

    (I know it refers to a Window installation and you are on a Unix server, but the idea remains valid)

    I figured that PuttyGen had generated an SSH2 public key file in a slightly different format, and ‘git gitosis-init’ wanted a user name at the beginning, so I went here:

    http://www.rfc-archive.org/getrfc.php?rfc=4716

    and saw that I could keep the “--BEGIN…” and “--END” parts, and replace the “comment: ...” line (generated by PuttyGen) with a line reading:

    subject: git
    

    And it worked! I got the output:

    Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
    Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/
    

    You can also try to copy just the key, as in this thread:

    It's work fine for my ssh-pubkey on rawhide. I assume you have the wrong file format.
    Try to copy id_rsa.pub key only (without comments, etc), run sudo -H -u gitosis gitosis-init, paste pubkey, then ^D.