Here is the situation, I have a folder named git which contains various --bare git repositories. This is on my server which is CentOS 5. My personal computer at home is a Windows XP.

I want to push my local repositories to my server using an account on a per-repository bases. I've been searching for hours with no luck. Here is what I've done which came the closest.

I ran a daemon at my server by typing:

git daemon --verbose --base-path=/path/to/git/parent/folder --export-all

I then use TortoiseGit to push at the address: git://myserver.com/project and I get this from the daemon:

Connection from XX.XX.XX.XX Extended
attributes (22 bytes) exist
receive-pack for '/project'
'receive-pack': service not enabled
for '/path/to/git/parent/project'
[XXXX] Disconnected (with error)

I used --enable=receive-pack and successfully push my local repository to the server but the result was not what I wanted: namely, to login in as a user. Receive-pack enables everyone to anonymously push to the server.

I've searched for hours but I cannot find how to configure accounts independently for each repository. I have read various articles saying something about SSH but I'm not sure if this is what I want. As far as I know, SSH is to securely connect to my server by logging in to a linux account at the server (i.e. root, userA etc.) And that is not what I want.

Take SVN for example, with subversion you can create a .htpasswd file with the accounts you want only for that specific repository. Is there a similar way with Git?

Thank you.

3 Answers 3


Check out gitosis which is a git repository hosting application. Quoting the description from the Debian package of gitosis:

This package aims to make hosting git repositories easier and safer.
It manages multiple repositories under one user account, using SSH
keys to identify users. End users do not need shell accounts on the
server; they will talk to one shared account that will not let them
run arbitrary commands.

You can find the gitosis source at http://eagain.net/gitweb/?p=gitosis.git

Documentation on how to set it up: http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way

I'm very happy with gitosis, we're using it at the grml project (http://grml.org/) with more than 100 repositories and it works fine without any problems.

  • We've been using gitosis at work, and it's pretty great. It's easy to set up, add, and manage repos, and it identifies you based on your SSH key (meaning no remembering usernames or passwords you don't already know). Dunno how well that works on Windows though, Win is pretty deficient in most such regards.
    – Dan Udey
    Jun 10, 2009 at 2:00

You could try using the 'git+ssh//' uri instead of 'git//'. This will allow you to run server-less (git wise) and to give different users permissions to each repository. Once you've done that, you can use


as a git remote location.

To initialize an empty repository, which you can push data into, use the 'git --bare init' command on the remote host.


Another thing you might want to consider, depending on what exactly you're doing, is Github. It works really well and is cheap, it's easy to maintain, and has some niceties like gists, built-in issue tracking, and so on. I quite like it for personal projects, and separate private repos don't cost much to add.

Sometimes it's worth not having to do it yourself.

  • 1
    Github is accquired by Microsoft and is not safe. Aug 20, 2018 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.