Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I was able to run the following command:

git clone admin@ip address:gitolite-admin.git

When I tried adding a new user using the steps below, the new user was unable to connect:

Steps taken so far:

1.  Copied the public key into the keydir (also tried copying it in a separate directory within the keydir)
2.  I added a repo in the config file for the new userID
3.  git add -A
4.  git commit -m 'adding new user keys and repo'
5.  git push origin master

All these commands run without throwing any errors.
When the user tries to login, he is unable to connect with the following command:

git clone username@IPAddress:newRepoName.git

The connection times out complaining about unable to connect on port 22. Any suggestions to help troubleshoot this (the public key for the user was generated from his computer - same one is being used for logging in as user - different computer was used for admin access). Thanks in advance

Edit: I removed the public key for a (non-admin) user, ran commit and pushed to the server after which I added a new public key for the user, ran add, commit & pushed to server. The response for the admin mentioned that the user was added. However, when the user tries connecting to the server using the command below, the connection attempt is unsuccessful (I can clone the project from my computer - the additional user cannot, neither can any other user so I am guessing I made a mistake in configuring additional users - any thoughts would be quite welcome and thanks for the patience)

git clone git@xx.xxx.xxx.xx:testProject Cloning into 'testProject'... Permission denied (publickey). fatal: The remote end hung up unexpectedly

share|improve this question
    
new user may have more than one key on their computer (for two separate git instances) - checking if that's the issue –  ali haider Jan 21 '13 at 23:12
    
Username? You always use the same account when ssh'ing a gitolite server. The authentication of the actual user will be done with the public key matched against what has been registered in the ~/.ssh/authorized_keys file on the gitolite side. –  VonC Jan 21 '13 at 23:16
    
I actually tried that as well earlier - but it does not connect (complains about "permission denied (public key)"). Any other suggestions would be most welcome. Thank you for your earlier feedback –  ali haider Jan 21 '13 at 23:56
    
I tried adding the public key again through the add command as well but it does not seem to have corrected the issue. –  ali haider Jan 21 '13 at 23:57

3 Answers 3

For others having the same problem, check whether AllowGroups is in use for ssh on the server. Might be the git-user on the server isn't in the correct group.

Diagnosis: attempt to ssh to the git-user on the server, and see what turns up in /var/log/auth.log If it says "User git from not allowed because none of user's groups are listed in AllowGroups", you need to check which groups are in AllowGroups and then add the git user to one of those.

share|improve this answer
up vote 1 down vote accepted

The issue was with the client setup for connecting to the amazon aws instance hosting git. I have accepted VonC's response since he was very responsive to all my questions.Thanks

  1. I had the user connect via ssh (using the ssh certificate file) - the user accepted the key for the connection to their computer.
  2. The user added a config file into their ~./ssh file in the following format:

    Host test.git.com

    HostName amazonHostName

    User adavid

    PreferredAuthentications publickey

    IdentityFile ~./ssh/adavid

The user ran the ssh-add command as well. However, they were not able to connect to the git repository using the short name and had to use the long name for the connection.

Once again - Merci beaucoup VonC!

share|improve this answer
    
I didn't see your feedback immediately. Good feedback, completing my answer. +1 –  VonC Feb 6 '13 at 10:27

This address won't ever work: git clone username@IPAddress:newRepoName.git

When using gitolite, you always use the same account:

git clone git@IPAddress:newRepoName.git

(if git is the account under which gitolite is installed)

See "adding and removing users" to understand how to declare a new user:

Ie adding his/her public key named after the user id in the gitolite.conf file.

Then the user must have his/her keys in ~/.ssh/id_rsa(.pub), and make any git command with git@IPAddress:newRepoName.git (git, not username)

share|improve this answer
    
thank you for your feedback. This is what I tried before posting the question: (1). get the new user to create the key on their computer (2) have them copy it to their ~/.ssh directory and ensure that they can connect without passwords (3) copy the key to a directory within the keydir (I have even tried copying it directly into the keydir) (4) add a repo to the gitolite.conf file permitting the new user and the admin (5) ran the commands I listed in my original post. –  ali haider Jan 22 '13 at 17:05
    
However, the new user is still unable to connect (using git clone git@ip address:repoName.git (I had tried both username and git@ so I guess that was not the issue). Any other useful suggestions would be most welcome. Thank you for your feedback so far. –  ali haider Jan 22 '13 at 17:09
    
I am able to clone the repo from my admin box. –  ali haider Jan 22 '13 at 17:35
    
@alihaider (2) I confirm a user should not be able to ssh (gitolite should intercept immediately) so you don't need that test: too soon. (3): it must be copied directly within keydir of the gitolite-admin repo local clone, named after the user id, as stated in sitaramc.github.com/gitolite/users.html . Don't forget to push back the gitolite-admin repo back to the server. –  VonC Jan 22 '13 at 18:42
    
@alihaider you always use git@, never ever username@. See stackoverflow.com/questions/13318715/… for the reason behind that usage. –  VonC Jan 22 '13 at 18:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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