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've been following this tutorial to install and setup git on Ubuntu Server 10.04 using Windows 7 as a client. However, after finally figuring out how it works (executed gitosis-init a bunch of times on the wrong key), I copied the id_rsa.pub file over to the server in /tmp folder and ran it again.

Unfortunately it still doesn't work and when I execute

git clone gitosis@yourserver.com:gitosis-admin.git

it asks for gitosis's password rather than the RSA Passphrase. I'm assuming is the same problem this guy is having here... however, after following his instructions:

Purge git-core and gitosis and manually remove the /srv/gitosis folder

and following the instructions again (with the proper id_rsa.pub file this time), I'm still having the same issue.

Anyone know what I'm doing wrong? Is there any way to probe for more information that might help in solving this?

Edit: output from ssh -vvv gitosis@{IP_ADDRESS} (The last few lines show where it's switching from publickey to password):

{UserName}@{COMPUTERNAME} ~
$ ssh -vvv gitosis@{IP_ADDRESS}
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug2: ssh_connect: needpriv 0
debug1: Connecting to {IP_ADDRESS} [{IP_ADDRESS}] port 22.
debug1: Connection established.
debug1: identity file /c/Users/{UserName}/.ssh/identity type -1
debug3: Not a RSA1 key file /c/Users/{UserName}/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'Proc-Type:'
debug3: key_read: missing keytype
debug2: key_type_from_name: unknown key type 'DEK-Info:'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
# Repeated 23 times here...
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /c/Users/{UserName}/.ssh/id_rsa type 1
debug1: identity file /c/Users/{UserName}/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu6
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu6 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
# Bunch of stuff here that doesn't seem important... I can include if necessary
debug3: check_host_in_hostfile: filename /c/Users/{UserName}/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug1: Host '192.168.0.113' is known and matches the RSA host key.
debug1: Found key in /c/Users/{UserName}/.ssh/known_hosts:1
debug2: bits set: 526/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /c/Users/{UserName}/.ssh/identity (0x0)
debug2: key: /c/Users/{UserName}/.ssh/id_rsa (0xa01a428)
debug2: key: /c/Users/{UserName}/.ssh/id_rsa (0x0)
debug1: Authenications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Trying private key: /c/Users/{UserName}/.ssh/identity
debug3: no such identity: /c/Users/{UserName}/.ssh/identity
debug1: Offering public key: /c/Users/{UserName}/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /c/Users/{UserName}/.ssh/id_dsa
debug3: no such identity: /c/Users/{UserName}/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password #it just switched to password...
debug3: remaining_preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password
gitosis@{IP_ADDRESS}'s password:
share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

As per this chat discussion, on possible cause was:

  • the value of HOME (correctly set to /C/Users/UserName)
  • versus the shell used for the various commands (Cygwin, because it had ssh-copy-id command, contrary to the msysgit bash shell)

Since ssh-copy-id only copy a line to a file (See "ssh-copy-id and duplicates in authorized_keys", it was simpler to:

  • generate the rsa keys in a msysgit bash session (the keys will be created in /c/Users/UserName/.ssh/id_rsa, snce $HOME refers to /c/Users/UserName/)
  • copy manually the content of id_rsa.pub to the ~/.ssh/authorized_keys of the server (since a direct access to said server was possible here).

The OP user29600 fixed it!

1) Made sure that HOME was in as an environment variable using C:\Users\UserName as the path.

2) Created the RSA keys in MingW "ssh-keygen -t rsa" and allowing for the default setting in file name and assigning a proper passphrase.

3) Did "ssh-copy-id -i $HOME/.ssh/id_rsa.pub {USER}@{SERVER_IP}" to ensure RSA key auth was enabled for that user. 4) sent the .pub file to the server using "

scp $HOME/.ssh/id_rsa.pub {USER}@{SERVER_IP}:/tmp

5) installed git-core and gitosis and executed "sudo -H -u gitosis gitosis-init < /tmp/id_rsa.pub"

6) Had an error about permissions on the id_rsa file when using MingW.
Found this article that said to copy the ssh.exe file from C:\cygwin\bin to C:\Program Files\Git\bin and overwrite the file, included the necessary .dll files.
This step was because MingW was not setting or reading chmods properly... cygwin showed 600, MingW showed 644.
After copying over the ssh.exe file, I was able to properly chmod the files with MingW and the permission error went away.

7) "git clone gitosis@{SERVER_IP}:gitosis-admin.git" finally worked!

share|improve this answer
add comment

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.