Search code examples
gitsshgitosis

E-mail as Git SSH User


I'm in a project where all users from a LDAP server just have e-mails as unique identifier. I need to have users clone their projects from their remote home directories on a linux server. So I'm thinking about using the SSH protocol for GIT to athentication and authorization them.

But i'm facing problems when using the Eclipse EGit plugin, because the git clone command looks like this:

git clone jhon.smith@emailserver@reposerver:pathtosomeproject

Eclipse trying to help by escaping the @:

git clone jhon.smith%40emailserver@reposerver:pathtosomeproject

But this doesn't work, and it shows an authentication error. What I did was to put a '' in the e-mail.

git clone 'jhon.smith@emailserver'@reposerver:pathtosomeproject

This works well, but when Eclipse tries to list all branches with ls-remote in the next page, it says that cannot show with a message error.

My question is if someone has already experienced this requirements and has an alternative solution?

I don't know if Gitosis would help here, because the environment will not have groups, just users with their projects inside their home folders and using Eclipse EGit to clone and push the projects.

Thanks


Solution

  • First, gitosis is obsolete, use Gitolite.

    Second, an ssh address is for an admin account (say 'gitadmin' for instance) of the Git repo server to check if one's public key is in that ~gitadmin/.ssh/authorized_keys.

    When you uses an ssh address like "jhon.smith@emailserver@reposerver:pathtosomeproject", you ask to the reposerver SSH daemon to check ~jhon.smith@emailserver/.ssh/authorized_keys, which makes no sense (you have one Git admin account, not one per user!, and I doubt you would find on an unix server a user id name 'jhon.smith@emailserver')

    Gitolite would help in that it would formalized the public key that each user would communicate. Read "adding and removing users", and "ssh basis".
    The name of that public key will represent their 'id' as viewed from the Gitolite server.
    (so don't take a complicated public ssh key like jhon.smith@emailserver! jhon.smith_emailserver and jhon.smith_emailserver.pub would do just fine, for instance)