Search code examples
gitsshgitolite

Locked out of gitolite and cant gl-admin-push


I stupidly formatted my laptop hard drive with the ssh keys for gitolite, I have root access to my server and have followed this answer Gitolite access repair and have successfully made a copy of my repo in the tmp folder and fixed the file

My problem is that i get an error when doing "gl-admin-push" here is the error:

Unable to determine correct path for gitolite scripts from the authkeys file.

Perhaps you haven't installed gitolite yet?

Or perhaps this is an HTTP mode install?  If so, please set the GL_BINDIR
environment variable to the full path of the gitolite scripts, then re-try
this command.  For example (if you followed doc/http-backend.mkd precisely):

GL_BINDIR=/var/www/gitolite-home/bin /home/git/bin/gl-admin-push 

My gitolite install was working fine before I locked myself out (facepalm)

Anny Ideas of how I can get out of this mess ?


Solution

  • The OP Purplefish32 realized that this message can also occur if the user executing the the gl-admin-push hasn't its public key properly registered.

    That key needs to be set with the gitolite force-command script.

    command="/home/git/bin/gl-auth-command myusername",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
    

    This is consistent with what that script does:

    # if GL_BINDIR was not passed in, find it
    [ -z "$GL_BINDIR" ] &&
        GL_BINDIR=`  perl -ne 'print($1), exit if /^command="(.+?)\/gl-(time|auth-command) /' < $HOME/.ssh/authorized_keys`
    # GL_BINDIR still not known?  we have a problem...
    [ -z "$GL_BINDIR" ] && {
        echo "
    
    Unable to determine correct path for gitolite scripts from the authkeys file.