Unable to add user with Gitolite

I'm new to gitolite. I am installing gitolite on a remote server.

http://dev.remoteserver.com

      

So, I could git-cloning gitolite-admin.git.

git clone ssh://gitolite@dev.remoteserver.com/gitolite-admin.git

      

I wanted to add user and repo using gitolit. The next is the usual process for adding users.


In the local repository, conf / keydir exists.

open conf/gitolite.conf 

      

added below the text.

repo   aproject
       RW+ = testid

      

and, in local-mac,

ssh-keygen -t rsa. 

      

added the public key to keydir / testid.pub
and then git add / git commit / git push works well.


okay then I tried to clone the new git repository from the remote server.

git clone ssh://testid@dev.remoteserver.com/aproject.git

      

but it makes a mistake like this ...

mac$ git clone ssh://testid@dev.remoteserver.com/aproject.git
Cloning into 'aproject'...
mac@dev.remoteserver.com password: 
Permission denied, please try again.
mac@dev.remoteserver.com password: 
Permission denied, please try again.
mac@dev.remoteserver.com password: 
Permission denied (publickey,gssapi-with-mic,password).
fatal: The remote end hung up unexpectedly

      

I think git clone shoud doesn't ask for password. and the correct password also failed git-cloning.

My remote server is CentOS.

and comments are welcome.

+3


source to share


2 answers


With gitolite

all your ssh messages done with the account used for the installation gitolite

.
In your case: gitolite

.

However, you can specify a different public key to specify gitolite

for authentication with a different user.
The ssh session will still run as gitolite

.
But the name passed to the gitolite

script will be testid

(since the public key was registered gitolite

in its ~/.ssh/authorized_keys

as ' testid

')

So use the file ~testid/.ssh/config

where you give the correct parameter:

Host gitolitesrv
Hostname dev.remoteserver.com
User gitolite
IdentityFile /path/to/tesitd

      

Note that this /path/to/

must contain your private key testid

and your public key testid.pub

.
At this stage, their name is irrelevant (can be xxx

and xxx.pub

)
was important public key name is stored in gitolite-admin/keydir/testid.pub

(since the file name is used for the identifier recorded in authorized_keys

a forced command
)

And then this one git clone

should work:

git clone gitolitesrv:aproject.git

      


OP Jinbom Heo mentions difficulties:



Cloning into an "object" ... R access for a DENIED object to gitolite
(Or there could be no repository along the given path. Did you name it correctly?) Fatal: the remote end hung up unexpectedly

it seems that the git user is not testid

as well gitolite

.

Host dev2git 
  Hostname dev.remoteserver.com 
  User gitolite 
  IdentityFile ~/.ssh/testid

      

And the file gitolite.conf

includes the following (git-pushed):

repo aproject RW + = testid

Finally, I found the reason.
When generating ssh key using ssh-keygen, I typed in a password . This is problem.
So I tried keygen without password and it works ~. I don't know why the password should not be added when I make the key. Anyway, it works well


I can confirm that I always use keys without a passphrase .
I want to protect your key passphrase, see ". Annex 1: ssh daemon prompts for a password "

make sure you are prompted for a password and not a passphrase.
Do not be confused or mistaken in the prompt "Enter a passphrase for the key" /home/sitaram/.ssh/id_rsa

": to request a password from a remote server!

When you create ssh keypair

with help ssh-keygen

, you have the option to protect it with a passphrase.
When you subsequently use this keypair

to access a remote host, the local client ssh

needs to unlock the corresponding private key, and ssh

possibly ask for a passphrase when you createdkeypair

.

You have two options to avoid this prompt every time you try to use the private key.

  • The first is to generate key pairs without a passphrase (just hit enter when prompted for one).
    Don't forget to add the passphrase later, once everything is working using ssh-keygen -p

    .
  • The second is using ssh-agent

    (or keychain

    , which in turn uses ssh-agent

    ) or something similar to manage your keys.
    In addition to discussing another potential issue with ssh-agent

    (see Appendix 3: The ssh client may not offer the correct key ), further discussion ssh-agent/keychain

    is outside the scope of this document.
+6


source


I was having problems cloning the repository gitolite-admin

after the initial setup and it was because I gave the group write permissions to the gitolite user's home folder git

and ssh

didn't like that.


I checked Check /var/log/secure

and saw this:

Authentication denied: poor ownership or modes for directory / home / git



So, all I needed to do was:

sudo chmod g-w /home/git/

Links:

0


source







All Articles