Gitolite hook doesn't work

2019-06-12 14:54发布

问题:

I've set a GIT server on Windows with Cygwin and gitolite as it's described in the article. On a client Windows machine I use TortoiseGit.

Right after the setup everything works ok. I can clone gitolite-admin repository with TortoiseGit using my SSH key and see the repository content.

But right after I try to push a new content of /conf/gitolite.conf the server is not accessible anymore using my SSH key (it's removed from *authorised_keys* on the server by gitolite).

The new content of gitolite.conf (I would like to add new repository Project):

repo    gitolite-admin
        RW+     =   alexey

repo    Project
        RW+     =   alexey

repo    testing
        RW+     =   @all

What's wrong with it?

回答1:

The problem was in sshd service environment. See this link for details.

To fix the problem reinstall the service with proper PATH variable setting. To do this on Windows Server 2008 use:

cygrunsrv -R sshd
cygrunsrv -I sshd -d "CYGWIN sshd" -p /usr/sbin/sshd -a "-D" -y tcpip -u cyg_server -w {cyg_server_password} --env "PATH=/usr/local/bin:/usr/bin:/bin:/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/Wbem"
cygrunsrv -S sshd

If you don't remember cyg_server account password you can rerun ssh-host-config.

To restore access for your public key use:

gl-setup ~/YourKey.pub

After these you can access and modify your gitolite-admin repository remotely.