4

I'm trying to setup Git's remote SSH server to access this using SSH, but I haven't found any info how to make this.

Does Git has built-in SSH tools to establish such connection to use this "right out of the box"? Or should I use some third-party one?

jub0bs
  • 60,866
  • 25
  • 183
  • 186
WildDev
  • 2,250
  • 5
  • 35
  • 67

2 Answers2

3

Git does not have an inbuilt ssh server. Git assumes that

  • the git client can use the ssh binary to initiate an ssh connection
  • the git server (at least on Unix) can be invoked as a command run from the ssh server.

You are probably familiar with the syntax

ssh foo.bar baz

which runs baz on foo.bar. The git client uses a similar configuration to run the ssh server which in turn runs the server-side git binary (the same binary as the client but run with different flags). Normally you would have a git user to do this. You can do this without any programs other than ssh and git (see first answer here) but you may find installing gitolite makes things easier (in essence your git server config is also stored in a git repo, so you don't have to do any server side maintenance by logging in).

Community
  • 1
  • 1
abligh
  • 24,573
  • 4
  • 47
  • 84
  • Using "client" and "server" may be slightly confusing as it is the same in both ends. – Thorbjørn Ravn Andersen Jun 28 '15 at 21:01
  • @ThorbjørnRavnAndersen fixed – abligh Jun 28 '15 at 23:15
  • 1
    So does the SSHD daemon need to be up and running (In other words `service ssh start` on ubuntu), or is the ssh binary run on demand on each connection and then exited? Also for example if I do a push over ssh does the server need to processes to handle the request - one for ssh and one for git - or is it all handled in the same process? – Ole Mar 04 '16 at 20:13
  • 1
    sshd needs to be available to run processes. In an Ubuntu install, that's nearly always achieved by having a service (and daemon) running, which on a request forks and runs the command requested. If you do a push over ssh, the ssh daemon will fork and run the git binary serve side, which will process the request. – abligh Mar 04 '16 at 22:47
1

No, I am sorry. You need to install appropriate ssh tools(like openssh) and configure your server to allow ssh. After that you just init a bare repository on your server and copy your ssh-key to your server.

ckruczek
  • 2,361
  • 2
  • 20
  • 23