/home/myuser/gitlab.
test git@localhost:root/testing.git I found that there was a problem with my ssh connect. Here's my /home/myhome/.ssh/config file
Host mylocalhost
Hostname localhost
User git
IdentityFile /home/myuser/.ssh/id_rsa
When I run git push -u origin master I am asked to enter my passphrase. But, immediately after I get this message
Connection closed by ::1
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Where am I going wrong ? Is this my ssh connection
Update : I stopped sshd and the ran sshd -d (in my /home/myhome) and then ssh -T mylocalhost, I got in the ssh -d output
debug1: sshd version OpenSSH_6.2, OSSLShim 0.9.8r 8 Dec 2011
debug1: read PEM private key done: type RSA
debug1: private host key: #0 type 1 RSA
debug1: read PEM private key done: type DSA
debug1: private host key: #1 type 2 DSA
debug1: rexec_argv[0]='/usr/sbin/sshd'
debug1: rexec_argv[1]='-d'
debug1: Bind to port 22 on 0.0.0.0.
Server listening on 0.0.0.0 port 22.
debug1: Bind to port 22 on ::.
Server listening on :: port 22.
debug1: fd 6 clearing O_NONBLOCK
debug1: Server will not fork when running in debugging mode.
debug1: rexec start in 6 out 6 newsock 6 pipe -1 sock 9
debug1: inetd sockets after dupping: 5, 5
Connection from ::1 port 51579
debug1: Client protocol version 2.0; client software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: permanently_set_uid: 75/75 [preauth]
debug1: list_hostkey_types: ssh-rsa,ssh-dss [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: client->server aes128-ctr [email protected] none [preauth]
debug1: kex: server->client aes128-ctr [email protected] none [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST received [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_GROUP sent [preauth]
debug1: expecting SSH2_MSG_KEX_DH_GEX_INIT [preauth]
debug1: SSH2_MSG_KEX_DH_GEX_REPLY sent [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user git service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: PAM: initializing for "git"
debug1: PAM: setting PAM_RHOST to "localhost"
debug1: userauth-request for user git service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: test whether pkalg/pkblob are acceptable [preauth]
debug1: temporarily_use_uid: 1111/20 (e=0/0)
debug1: trying public key file /Users/git/.ssh/authorized_keys
debug1: fd 6 clearing O_NONBLOCK
debug1: matching key found: file /Users/git/.ssh/authorized_keys, line 1
Found matching RSA key: e9:70:a8:96:1c:a5:b4:b0:58:b0:b8:22:6f:9b:98:bb
debug1: restore_uid: 0/0
Postponed publickey for git from ::1 port 51579 ssh2 [preauth]
debug1: userauth-request for user git service ssh-connection method publickey [preauth]
debug1: attempt 2 failures 0 [preauth]
debug1: temporarily_use_uid: 1111/20 (e=0/0)
debug1: trying public key file /Users/git/.ssh/authorized_keys
debug1: fd 6 clearing O_NONBLOCK
debug1: matching key found: file /Users/git/.ssh/authorized_keys, line 1
Found matching RSA key: e9:70:a8:96:1c:a5:b4:b0:58:b0:b8:22:6f:9b:98:bb
debug1: restore_uid: 0/0
debug1: ssh_rsa_verify: signature correct
debug1: do_pam_account: called
Failed publickey for git from ::1 port 51579 ssh2
debug1: audit_event: unhandled event 6
Access denied for user git by PAM account configuration [preauth]
debug1: do_cleanup [preauth]
debug1: monitor_read_log: child log fd closed
debug1: do_cleanup
debug1: PAM: cleanup
debug1: Killing privsep child 17748
debug1: audit_event: unhandled event 12
Btw, each time I run some git command, I get the message
ssh: Could not resolve hostname mylocalhost: nodename nor servname provided, or not known
fatal: Could not read from remote repository.
Update 2
When I run ssh mylocalhost, I have the good message Welcome to GitLab, Administrator!. But then, I get the following input
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)
Transferred: sent 3284, received 3480 bytes, in 0.4 seconds
Bytes per second: sent 7501.3, received 7949.0
debug1: Exit status 0`
and in my GitLab log
Started GET "/api/v3/internal/allowed?key_id=4&action=git-receive-pack&ref=_any&project=testing" for 127.0.0.1 at 2013-11-07 16:48:00 +0100
If you are using the SCP-like syntax for the ssh url, then, considering your ~/.ssh/config, that url should be:
git remote set-url origin mylocalhost:root/testing.git
That supposes that you have added your public key (the ~/.ssh/id_rsa.pub) in your GitLab account page:

And that the access protection is correct
on the local side
as well as on the server side
chmod 700 /home/git/.ssh
chmod 600 /home/git/.ssh/authorized_keys
The OP Newben reports (in the comments):
I had to go to my osx shared preferences panel and set manually the users remote access perms.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With