JimJim2000 JimJim2000 - 5 months ago 25
Git Question

Git - is git required on server?

I just started learning git and I've read a lot of information but still can't understand. Let's suppose we have server machine and client machine. The client connects to server via ssh. There is no any authentication on server for git. I consider the simplest configuration- there are three clients and one server. On server git repo is stored

Do we need to install git on server this case? I am confused as

git push
git clone
commands are executed using git on client side.


As others pointed out, you don't need a "server" in the sense "one big machine somewhere on the internet", but if you use git push, the machine on which you run git push is technically the client machine, and the one you push to is the server during this operation.

When you run git push, Git essentially runs ssh user@server 'git-receive-pack /path/to/repo', i.e. it runs git-receive-pack on the server. Then, the local git push talks to the remote git-receive-pack via the SSH connection.

In short: you need Git on the server when pushing through SSH. Not necessarily a full installation, but at least the executable git-receive-pack to push and git-upload-pack to fetch/pull.

It's also possible to push to a remote machine without Git installed there using other protocols (eg. webdav), but I wouldn't recommend it.