I have setup my git server using Gitosis. I need to checkout the repository as different user on the same machine.

Suppose there are two machines:

  1. Linux based server (on which the repo is held under user name "GIT"; another user "Dev1" is one of the developers)
  2. Windows machine (user name "tech_geek")

How can I checkout the repo as "Dev1" to the Windows machine and also as "tech_geek"? So there will be two repositories checked out on the windows machine.

2 Answers 2


1) Clone Gitosis admin repo:

$ git clone git@SERVER:gitosis-admin.git

2) Add Dev1's and tech_geek's SSH public keys to gitosis-admin/keydir (rename each public key id_rsa.pub) as dev1.pub and tech_geek.pub. Add to file gitosis-admin/gitosis.conf

[group developers]
members = dev1 tech_geek
[group new_project]
writable = new_project
members = @developers

where new_project is repo name (without .git suffix)
3) Commit and push

$ cd gitosis-admin
$ git add .
$ git commit -m "New devs and repo for new_project"
$ git push

4) Try to clone repo (as user Dev1 or tech_geek) from Windows hosts

$ git clone git@SERVER:new_project.git

Nowadays use the environment variable GIT_SSH_COMMAND . (GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa_example" git clone example)

See: https://superuser.com/questions/232373/how-to-tell-git-which-private-key-to-use

If you use one of the GUI tools it might be easier for you to choose the key.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .