9

I need an application to be able to fetch from a git repository but not push to it, so, that's the read-only part. That could easily be done with git daemon.

On top of that, I need access to said repository to be password-protected, including for reading it. So before any fetching can happen, the application will need to authenticate.

Is it doable? with git daemon? something else? http + auth maybe?

kch
  • 77,385
  • 46
  • 136
  • 148
  • What do you mean fetch but not pull? pull is just a fetch + merge locally. pull is a read-only operation, unless I'm missing something. – Paul Holden Feb 10 '09 at 20:14

6 Answers6

6

HTTP authentication will not protect the pack being transmitted over the wire, so if you are worried about eavesdroppers HTTP authentication will not suffice. Also, git is much more efficient using the git protocol than the HTTP protocol. git-daemon, however, does not do authentication for you.

Probably the best solution is to use gitosis which will allow you to protect the repository using ssh--cryptographically strong authentication, and confidentiality over the wire--and control access to the repository as well (e.g., have some users read-write and some users read-only). This will use the efficient git protocol over your ssh connection.

If you are willing to outsource this, github is perhaps the best approach. They have plans at different price points to meet many needs.

Emil Sit
  • 22,894
  • 7
  • 53
  • 75
  • I have a free github account that I use for my open projects. Do they have stuff to deal with authentication/authorization beyond ssh in the paid accounts? – kch Feb 10 '09 at 22:27
  • Hm, on further examination it looks like they do not support authenticated read-only access; their plan listing is at http://github.com/plans and you can contact support@github.com with questions. – Emil Sit Feb 11 '09 at 23:44
2

The easiest way is to setup HTTP authentication on top of gitweb. See there.

Keltia
  • 14,535
  • 3
  • 29
  • 30
0

Use gitolite. That's just the best: easy to setup (if you already know SSH key management), complete control on user access and transport security (SSH).

dolmen
  • 8,126
  • 5
  • 40
  • 42
0

I like having a combination out of git + gitolite + gitweb

  • where gitweb gives a very lean and fast webfrontend

  • and gitolite is doing all authorization tasks, so you can give permissions to read or write on a (ssh) user-level (even the configuration of gitolite is handeled as a plain git repository, that means, authorization/configuration changes are trackable)

Hartmut Pfarr
  • 5,534
  • 5
  • 36
  • 42
0

To create an authenticated "read only" repository, provide SSH access to the repository for all applicable parties but only allow push requests (write access) to a sub-set of the parties by using an update-hook as exampled here.

chris
  • 831
  • 1
  • 8
  • 13
0

You can fetch via SSH, which is both authenticated and encrypted channel. I don't know if gitosis would help you to manage SSH acces in lieu of setting up shell accounts with git-shell as shell.

Jakub Narębski
  • 309,089
  • 65
  • 217
  • 230