views:

1623

answers:

5

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?

A: 

http://letmegooglethatforyou.com/?q=git+http+auth&l=1

Henrik Paul
Not an especially helpful response.
Aaron Maenpaa
Actually the googled page is very helpful because it describes exactly what kch wanted.
Bombe
I'm a bit amazed about the reactions too (I've got even one offensive flag! passive-aggressive I'd understand, but _offensive_?). The page seemed to solve what was asked. I guess I should've plagiarized the content instead...
Henrik Paul
Let me first say I'm a fan of letmegooglethatforyou and justfuckinggoogleit, but if you mean an honest answer, a plain google link might be better accepted. (maybe a "first hit does it" note, along with)
kch
+1  A: 

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

Keltia
+6  A: 

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
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
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 [email protected] with questions.
Emil
A: 

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
A: 

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