Information Technology Reference
In-Depth Information
Protocol Read-only access:
Read/write access:
No authentication required
Authenticated users only
https
Yes
Yes
git
Yes
No
The recipes in this chapter contain detailed tutorials showing how to host repositor-
ies over ssh, http, and git. Because I honestly consider ssh the most important solution,
we will dive into the details concerning this protocol. I will not only provide you with
general information on how ssh authenticates users but also explain the following:
• Generating RSA keys
• Using authorized_keys file
• Configuring ssh with /.ssh/config file
Although this knowledge is not strictly related to git but to ssh, I really believe you
will need it. As I have already explained, ssh is the best solution for private repositor-
ies. The more confident you are with ssh the better.
For those who need to serve repositories with anonymous access, we will use both
http and git protocols. If efficiency is one of your concerns then you should use git nat-
ive protocol.
The phrase “hosting git repository over http” refers to allowing git fetch and git
clone operations to be executed through the http connection. Using a web browser for
such a repository would be useless: you will get the listing of the working directory and
the .git repository. If you want to inspect repositories with a web browser, you need the
web application. I will show you two the most popular solutions: gitweb and cgit. Git-
web is a Perl script that was developed by git creators and is included in git sources.
Cgit is written in C and it is considered to be the fastest CGI application for git. The
other advantage of cgit is that it allows you to append a URL to clone a repository.
The last two recipes concern the problem of privileges. When you host git repositor-
ies over ssh the authenticated user gains full access to all the repositories. There is no
built-in support either in git or ssh to restrict access. If you want to grant access on:
• A per user basis
• A per repository basis
• A per branch (in general: per reference) basis
Search WWH ::




Custom Search