1

I use gitosis to manage git repositories. normally I clone a project with command pattern like this

git clone git@host:MyProject.git

The full path of MyProject is /home/git/repositories/MyProject.git

Today, I want to create a new account to share my project, so I create a account named share, with this account, I use ssh-keygen to create a ssh key, and put it in gitosis.

Now it can access the project. But the question is: with this account, I have to access repositories with full path:

git clone share@host:/home/git/repositories/MyProject.git

Does anyone know how to clone it just with the project name?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250

1 Answers1

1

This is not how gitosis (which is obsolete since 2009) or gitolite is working.
See "How do programs like gitolite work?" (which applies also for gitosis)

The url of your repo will always be git@host:MyProject.git, meaning you always access that service through ssh with the account git.

You will simply use a different public/private key (share/share.pub) when using that url: that will allow gitosis/gitolite (installed on host) to authenticate you as share and access the MyProject.git in the pre-configured path.

Define a config file: ~/.ssh/config with in it:

host gitosis-share
     user git
     hostname host.com
     identityfile ~/.ssh/share

And use the url: gitosis-share:MyProject.git

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • A former coworker likes to say that "the cure for gitosis is gitolite" :) [s/git/hali/ if needed] – torek Sep 23 '15 at 07:37
  • Hi, VonC, the problem is so many people(someone I even don't know them) want to clone this project. I can not use public/private key to manage this. can I have a way to share this project just with username and password? – 会弹钢琴的狼 Sep 23 '15 at 08:14
  • @会弹钢琴的狼 that is not the question originally asked. The question was: how to access it with the new account named '`share`'. That would imply to distribute the private ssh key, by the way, which isn't really a best practice. But I have answered the question. For a public read-only access, you would need http(s) access: http://stackoverflow.com/a/16759565/6309 – VonC Sep 23 '15 at 08:19
  • @VonC, Thank you very much :) – 会弹钢琴的狼 Sep 23 '15 at 08:29