I'm created user "gitproxy" on the server side, added my ssh key to its authorized keys and trying to work with git daemon over ssh:
gitproxy:~$ git daemon --port=2222 --verbose
but have the error: On client side:
o:~/git$ git clone ssh://server>:2222/home/gitproxy/git
Cloning into 'git'...
ssh: connect to host <server> port 2222: Connection refused
fatal: Could not read from remote repository.
On server-side:
[18666] Ready to rumble
[18667] Connection from 192.168.211.174:42416
fatal: protocol error: bad line length character: SSH-
[18666] [18667] Disconnected (with error)
Repo is exists. Also I normally enter this server via SSH without a password (so, my ssh key is accepted):
$ ssh [email protected]
[email protected]:~$
Also, I can get list of branches with git-receive-pack from my desktop (client side):
$ ssh [email protected] git-receive-pack /home/gitproxy/git
008fef8bbf80818e6b634ca56c3ef6c24e5bbdb7bf74 refs/heads/masterreport-status delete-refs side-band-64k quiet atomic ofs-delta agent=git/2.16.1
0046ef8bbf80818e6b634ca56c3ef6c24e5bbdb7bf74 refs/remotes/origin/HEAD
0048ef8bbf80818e6b634ca56c3ef6c24e5bbdb7bf74 refs/remotes/origin/master
I checked all the possible fixes that are proposed on stackoverflow. But git daemon still returns the error. I'll be very grateful for any help. Thanks in advance!
Then, using only SSH (an no git daemon at all), you can use the SSH forced command mechanism that I illustrate for instance with gitolite.
In the ~gitproxy/.ssh/authorized_keys, you can call any script you want which will do an action, and then call Git itself, using
$SSH_ORIGINAL_COMMAND(which will include the "git-upload-pack|git-receive-pack|git-upload-archive"Git command).You can even install gitolite itself, as it would manage the authorization part for you.