Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29975

Is that necessary to install Git server if I want to have remote repository access over ssh?

Could you please explain, do I really need to install git server on the remote machine if I only need to place repository there and access it over ssh?

My ignorance probably starts from misunderstanding some key git operation principle so I would be glad if someone will explain it to me.

I thought that remote server for git is just a place where it stores files pretty much like local folder of my PC and I can have remote server with ssh access to host my repo on it without a need to install git server binaries there.

Is that possible? If not, could you explain me this thing I miss?

Upvotes: 11

Views: 3652

Answers (3)

seb
seb

Reputation: 4096

All the files required by git to run are stored locally to a checkout (in the .git directory). You could just access your git repository over SSH and effectively treat it like a repository on your local machine, e.g by mounting the remote folder locally.

However, I'm not sure why you'd want to do that. You can't do anything useful without the git binaries installed. If you just wanted to use the repository for private versioning, then you might as well install and run in locally, and back it up with your usual backup methods. If you want to use the repository to collaborate with others, then you need the git binaries available on a server that all your collaborators can access.

There is no meaningful distinction between a git "server" and a git "client". It's a distributed versioning system, which means each checkout is a fully-functioning version repository in its own right.

Upvotes: 5

Wes Hardaker
Wes Hardaker

Reputation: 22262

If operating over SSH you don't need a git server. The trick are getting the file permissions correct so that everyone can edit the files.

If you're doing this just for yourself, on the server:

 git init --bare

If you're doing it with other developers then you'll need to:

 mkdir repo
 chgrp GROUP repo
 chmod g+rwxs repo
 cd repo
 git init --bare --shared=group

Upvotes: 3

VonC
VonC

Reputation: 1323953

Sure it is possible to have an ssh access without a "git server".
You need a ssh server (daemon) though.

Don't mix a "remote server" and a "remote (or upstream actually) repo: a remote repo can be a simple directory right next to your current repo (local protocol).

Gitolite is a good illustration, using the forced command mechanism of ssh to manage authorization (not access).
See Gitolite without SSH to realize that just a sshd is enough for git repo access.

See also Pro Git book for the various protocols supported by Git.

Upvotes: 4

Related Questions