I installed a Git server with gitosis in Ubuntu 4.10 64 bits. The server works OK, but a user has asked me to run the command git archive --remote .


This option Git, so I've read, is disabled and has to be enabled by using git-daemon. http://linux.die.net/man/1/git-daemon

I installed the required package for git-daemon:

apt-get install git-daemon-run

And I configured the configuration file /etc/sv/git-daemon/run:


exec 2> & 1

echo 'git-daemon starting.'

exec chpst -ugitdaemon chpst-exec /usr/lib/git-core/git-daemon --verbose --export-all --enable=upload-archive --base-path =/srv/gitosis/git /srv/gitosis/git

Start the service:

sv up git-daemon

From the user's PC run:

$ git archive --remote ssh://gitosis@servername/repository/

And the following error:

ERROR: gitosis.serve.main: Unknown command denied fatal: The remote end hung up unexpectedly

I searched for information and have not found anything. Any idea because it fails?

P.D: Sorry for my English

  • Are you trying to run git archive against Github repositiories by any chance? – avimehenwal May 3 '18 at 18:14

Can you ssh into the server using the gitosis user?

If not this might be a problem with your ssh keys.

  • Yes, I can connect from random PC. In fact, I can work with Git repositories. For example, I can clone a repository on a local machine. – Gon May 16 '12 at 12:23
  • With the gitosis user, and with keys not password? what is the result if you run: ssh gitosis@servername /bin/pwd? Should be something like /home/gitosis. – EivinGS May 16 '12 at 13:11
  • On my computer I have the file ~/.ssh/config with the following information: host servername Port 2022 # I configured git server with this port IdentityFile ~/.ssh/my_key With this configuration, run: ssh gitosis@servername /bin/pwd The following error appears: ERROR: gitosis.serve.main: Unknown command denied – Gon May 16 '12 at 14:06
  • If I delete the ~/.ssh/config and run: ssh -p2022 gitosis@servername /bin/pwd I enter the password and the screen shows me: /srv/gitosis – Gon May 16 '12 at 14:07
  • OK. Then it was the keys.. Go here and follow the guide on how to set it all up: link. See chapter 4. – EivinGS May 16 '12 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.