You are not logged in.

#1 2014-01-24 11:59:21

ImperialDwarf
Member
Registered: 2014-01-24
Posts: 3

[Solved] Gitlab + ssh

After installation Gitlab on Arch i cant connect to git user with ssh key (key was added via web interface). When i try do git push via i get error reading from remote repository, but if i do it with http all work fine. This problem i get only on Arch each time when i try install it. I using my home server(i7 2600k, 16 Gb ram and ssd) and digitalocean cloud (1 core, 1 Gb ram, base image - Arch Linux 2013.05 x64) for it.

Any one get this problem before? If yes, how you fix it?

Official guide link:

https://github.com/gitlabhq/gitlabhq/bl … llation.md

Installed for gitlab pkg list:

pacman -S sudo base-devel zlib libyaml openssl gdbm readline ncurses libffi curl git openssh redis checkinstall libxml2 libxslt icu python2 python-docutils nginx mariadb ruby

gemrc: --no-user-install

Systemd files:

gitlab.target

gitlab-sidekiq.service

gitlab-unicorn.service

$ git push -u origin master
Enter passphrase for key '/c/Users/*****/.ssh/id_rsa':
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Connection log from Windows via ssh (same situation on arch desktop)

$ ssh -vT git@*****
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to ***** [*****] port 22.
debug1: Connection established.
debug1: identity file /c/Users/*****/.ssh/identity type -1
debug1: identity file /c/Users/*****/.ssh/id_rsa type 1
debug1: identity file /c/Users/*****/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.4
debug1: match: OpenSSH_6.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '*****' is known and matches the RSA host key.
debug1: Found key in /c/Users/******/.ssh/known_hosts:3
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/*****/.ssh/identity
debug1: Offering public key: /c/Users/*****/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/c/Users/*****/.ssh/id_rsa':
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: Remote: Forced command.
debug1: Remote: Port forwarding disabled.
debug1: Remote: X11 forwarding disabled.
debug1: Remote: Agent forwarding disabled.
debug1: Remote: Pty allocation disabled.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 0.4 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 1

cat /home/git/.ssh/authorized_keys

command="/home/git/gitlab-shell/bin/gitlab-shell key-1",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa ******** ****@*****

Gitlab check

[root@arch-gitlab gitlab]# sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production

Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.7.9 ? ... OK (1.8.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
update hook up-to-date? ... yes
update hooks in repos are links: ...
Administrator / test ... repository is empty
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: OK
Check directories and files:
        /home/git/repositories: OK
        /home/git/.ssh/authorized_keys: OK
Test redis-cli executable: redis-cli 2.8.4
Send ping to redis server: PONG
gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes
Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking LDAP ...

LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... no
  Try fixing it:
  Install the init script
  For more information see:
  doc/install/installation.md in section "Install Init Script"
  Please fix the error above and rerun the checks.
Init script up-to-date? ... can't check because of previous errors
projects have namespace: ...
Administrator / test ... yes
Projects have satellites? ...
Administrator / test ... can't create, repository is empty
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.5)

Checking GitLab ... Finished

Gitlab info

[root@arch-gitlab gitlab]# sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production

System information
System:         Arch Linux
Current User:   git
Using RVM:      no
Ruby Version:   2.0.0p353
Gem Version:    2.0.14
Bundler Version:1.5.2
Rake Version:   10.1.0

GitLab information
Version:        6.5.1
Revision:       6f6f158
Directory:      /home/git/gitlab
DB Adapter:     mysql2
URL:            http://localhost
HTTP Clone URL: http://localhost/some-project.git
SSH Clone URL:  git@localhost:some-project.git
Using LDAP:     no
Using Omniauth: no

GitLab Shell
Version:        1.8.0
Repositories:   /home/git/repositories/
Hooks:          /home/git/gitlab-shell/hooks/
Git:            /usr/bin/git

Ty for help and sorry for my bad english.

Last edited by ImperialDwarf (2014-01-27 10:58:14)

Offline

#2 2014-01-27 07:55:35

ImperialDwarf
Member
Registered: 2014-01-24
Posts: 3

Re: [Solved] Gitlab + ssh

Update. This fail log i found in sshd log. As i understand ssh cant send reply to client.

Jan 27 07:47:13 gitlab sshd[6435]: debug1: Forced command (key option) '/home/git/gitlab-shell/bin/gitlab-shell key-1'
Jan 27 07:47:13 gitlab sshd[6435]: debug2: fd 3 setting TCP_NODELAY
Jan 27 07:47:13 gitlab sshd[6435]: debug3: packet_set_tos: set IP_TOS 0x08
Jan 27 07:47:13 gitlab sshd[6435]: debug2: fd 10 setting O_NONBLOCK
Jan 27 07:47:13 gitlab sshd[6435]: debug2: fd 9 setting O_NONBLOCK
Jan 27 07:47:13 gitlab sshd[6437]: debug3: Copy environment: MAIL=/var/spool/mail/git
Jan 27 07:47:13 gitlab sshd[6435]: debug2: fd 12 setting O_NONBLOCK
Jan 27 07:47:13 gitlab sshd[6437]: debug3: Copy environment: XDG_SESSION_ID=11
Jan 27 07:47:13 gitlab sshd[6437]: debug3: Copy environment: XDG_RUNTIME_DIR=/run/user/1000
Jan 27 07:47:13 gitlab sshd[6435]: debug1: Received SIGCHLD.
Jan 27 07:47:13 gitlab sshd[6435]: debug1: session_by_pid: pid 6437
Jan 27 07:47:13 gitlab sshd[6435]: debug1: session_exit_message: session 0 channel 0 pid 6437
Jan 27 07:47:13 gitlab sshd[6435]: debug2: channel 0: request exit-status confirm 0
Jan 27 07:47:13 gitlab sshd[6435]: debug1: session_exit_message: release channel 0
Jan 27 07:47:13 gitlab sshd[6435]: debug2: channel 0: write failed

Offline

#3 2014-01-27 10:59:23

ImperialDwarf
Member
Registered: 2014-01-24
Posts: 3

Re: [Solved] Gitlab + ssh

My mistake ( Command for creating new user was "useradd -m -s /bin/false git" instead of "useradd -m -s /bin/bash git"

Offline

Board footer

Powered by FluxBB