Can't clone using SSH #4033

Closed
opened 2025-11-02 05:35:02 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @ripanioan on GitHub (Sep 29, 2019).

  • Gitea version (or commit ref): 1.9.3
  • Git version: 2.19.2
  • Operating system: Windows 10 Pro 64-bit
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Hi. I just installed Gitea on my machine a couple of days ago.
But I can't get SSH working.

In documentation is specified that ssh user@gitea_host should output the following:

Hi there, You've successfully authenticated, but Gitea does not provide shell access.
If this is unexpected, please log in with password and setup Gitea under another user.

In my case the output is:

PTY allocation request failed on channel 0
Connection to localhost closed.

As a note:
I didn't touch authorized_keys file. I added my public key through web ui.

Originally created by @ripanioan on GitHub (Sep 29, 2019). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.9.3 - Git version: 2.19.2 - Operating system: Windows 10 Pro 64-bit - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description Hi. I just installed Gitea on my machine a couple of days ago. But I can't get SSH working. In documentation is specified that `ssh user@gitea_host` should output the following: > Hi there, You've successfully authenticated, but Gitea does not provide shell access. > If this is unexpected, please log in with password and setup Gitea under another user. In my case the output is: > PTY allocation request failed on channel 0 > Connection to localhost closed. As a note: I didn't touch authorized_keys file. I added my public key through web ui.
GiteaMirror added the type/question label 2025-11-02 05:35:02 -06:00
Author
Owner

@bagasme commented on GitHub (Sep 30, 2019):

Any further logs from your system?

@bagasme commented on GitHub (Sep 30, 2019): Any further logs from your system?
Author
Owner

@ripanioan commented on GitHub (Oct 2, 2019):

I tried on another machine. Same behavior.
Maybe I'm not configuring it properly.

I run sshd -d manually and tried again ssh user@127.0.0.1.
Here is the output from sshd debug:

Connection from 127.0.0.1 port 50255 on 127.0.0.1 port 22
debug1: Client protocol version 2.0; client software version OpenSSH_for_Windows_7.7
debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7
debug1: sshd version OpenSSH_for_Windows_7.7, LibreSSL 2.6.5
debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth]
debug1: SSH2_MSG_KEXINIT sent [preauth]
debug1: SSH2_MSG_KEXINIT received [preauth]
debug1: kex: algorithm: curve25519-sha256 [preauth]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth]
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth]
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth]
debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth]
debug1: rekey after 134217728 blocks [preauth]
debug1: SSH2_MSG_NEWKEYS sent [preauth]
debug1: expecting SSH2_MSG_NEWKEYS [preauth]
debug1: SSH2_MSG_NEWKEYS received [preauth]
debug1: rekey after 134217728 blocks [preauth]
debug1: KEX done [preauth]
debug1: userauth-request for user Andreea service ssh-connection method none [preauth]
debug1: attempt 0 failures 0 [preauth]
debug1: userauth-request for user Andreea service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: userauth_pubkey: test pkalg rsa-sha2-512 pkblob RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc [preauth]
debug1: trying public key file C:\\Users\\Andreea\\.ssh/authorized_keys
debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: matching key found: RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc
debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: key options: command user-rc
debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: forced command: "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'"
Accepted key RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc found at C:\\Users\\Andreea\\.ssh/authorized_keys:2
Postponed publickey for Andreea from 127.0.0.1 port 50255 ssh2 [preauth]
debug1: userauth-request for user Andreea service ssh-connection method publickey [preauth]
debug1: attempt 2 failures 0 [preauth]
debug1: trying public key file C:\\Users\\Andreea\\.ssh/authorized_keys
debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: matching key found: RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc
debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: key options: command user-rc
debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: forced command: "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'"
Accepted key RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc found at C:\\Users\\Andreea\\.ssh/authorized_keys:2
debug1: auth_activate_options: setting new authentication options
Accepted publickey for Andreea from 127.0.0.1 port 50255 ssh2: RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc
debug1: monitor_child_preauth: Andreea has been authenticated by privileged process
debug1: auth_activate_options: setting new authentication options [preauth]
debug1: monitor_read_log: child log fd closed
debug1: Not running as SYSTEM: skipping loading user profile
User child is on pid 12916
debug1: sshd version OpenSSH_for_Windows_7.7, LibreSSL 2.6.5
debug1: rekey after 134217728 blocks
debug1: rekey after 134217728 blocks
debug1: ssh_packet_set_postauth: called
debug1: active: key options: command user-rc
debug1: active: forced command: "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'"
debug1: Entering interactive session for SSH2.
debug1: server_init_dispatch
debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384
debug1: input_session_request
debug1: channel 0: new [server-session]
debug1: session_new: session 0
debug1: session_open: channel 0
debug1: session_open: session 0: link with channel 0
debug1: server_input_channel_open: confirm session
debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
debug1: server_input_channel_req: channel 0 request pty-req reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req pty-req
debug1: Allocating a pty not permitted for this connection.
debug1: server_input_channel_req: channel 0 request shell reply 1
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req shell
Starting session: forced-command (key-option) 'F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'' for andreea from 127.0.0.1 port 50255 id 0
Environment:
  USER=andreea
  LOGNAME=andreea
  HOME=C:\Users\Andreea
  PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
  MAIL=/var/spool/mail/andreea
  SHELL=c:\windows\system32\cmd.exe
  SSH_CLIENT=127.0.0.1 50255 22
  SSH_CONNECTION=127.0.0.1 50255 127.0.0.1 22
debug1: Executing command: "c:\\windows\\system32\\cmd.exe" /c "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'" with no pty
debug1: server_input_channel_req: channel 0 request window-change reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req window-change
debug1: server_input_channel_req: channel 0 request window-change reply 0
debug1: session_by_channel: session 0 channel 0
debug1: session_input_channel_req: session 0 req window-change
debug1: Received SIGCHLD.
debug1: session_by_pid: pid 8612
debug1: session_exit_message: session 0 channel 0 pid 8612
debug1: session_exit_message: release channel 0
debug1: session_by_channel: session 0 channel 0
debug1: session_close_by_channel: channel 0 child 0
Close session: user andreea from 127.0.0.1 port 50255 id 0
debug1: channel 0: free: server-session, nchannels 1
Read error from remote host 127.0.0.1 port 50255: Unknown error
debug1: do_cleanup
debug1: do_cleanup
@ripanioan commented on GitHub (Oct 2, 2019): I tried on another machine. Same behavior. Maybe I'm not configuring it properly. I run `sshd -d` manually and tried again `ssh user@127.0.0.1`. Here is the output from sshd debug: ``` Connection from 127.0.0.1 port 50255 on 127.0.0.1 port 22 debug1: Client protocol version 2.0; client software version OpenSSH_for_Windows_7.7 debug1: match: OpenSSH_for_Windows_7.7 pat OpenSSH* compat 0x04000000 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.7 debug1: sshd version OpenSSH_for_Windows_7.7, LibreSSL 2.6.5 debug1: list_hostkey_types: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519 [preauth] debug1: SSH2_MSG_KEXINIT sent [preauth] debug1: SSH2_MSG_KEXINIT received [preauth] debug1: kex: algorithm: curve25519-sha256 [preauth] debug1: kex: host key algorithm: ecdsa-sha2-nistp256 [preauth] debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth] debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none [preauth] debug1: expecting SSH2_MSG_KEX_ECDH_INIT [preauth] debug1: rekey after 134217728 blocks [preauth] debug1: SSH2_MSG_NEWKEYS sent [preauth] debug1: expecting SSH2_MSG_NEWKEYS [preauth] debug1: SSH2_MSG_NEWKEYS received [preauth] debug1: rekey after 134217728 blocks [preauth] debug1: KEX done [preauth] debug1: userauth-request for user Andreea service ssh-connection method none [preauth] debug1: attempt 0 failures 0 [preauth] debug1: userauth-request for user Andreea service ssh-connection method publickey [preauth] debug1: attempt 1 failures 0 [preauth] debug1: userauth_pubkey: test pkalg rsa-sha2-512 pkblob RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc [preauth] debug1: trying public key file C:\\Users\\Andreea\\.ssh/authorized_keys debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: matching key found: RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: key options: command user-rc debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: forced command: "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'" Accepted key RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc found at C:\\Users\\Andreea\\.ssh/authorized_keys:2 Postponed publickey for Andreea from 127.0.0.1 port 50255 ssh2 [preauth] debug1: userauth-request for user Andreea service ssh-connection method publickey [preauth] debug1: attempt 2 failures 0 [preauth] debug1: trying public key file C:\\Users\\Andreea\\.ssh/authorized_keys debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: matching key found: RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: key options: command user-rc debug1: C:\\Users\\Andreea\\.ssh/authorized_keys:2: forced command: "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'" Accepted key RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc found at C:\\Users\\Andreea\\.ssh/authorized_keys:2 debug1: auth_activate_options: setting new authentication options Accepted publickey for Andreea from 127.0.0.1 port 50255 ssh2: RSA SHA256:BPJWBb9LtlaNdl+vDgedAggBCvgeCRU4en/VFHV+ORc debug1: monitor_child_preauth: Andreea has been authenticated by privileged process debug1: auth_activate_options: setting new authentication options [preauth] debug1: monitor_read_log: child log fd closed debug1: Not running as SYSTEM: skipping loading user profile User child is on pid 12916 debug1: sshd version OpenSSH_for_Windows_7.7, LibreSSL 2.6.5 debug1: rekey after 134217728 blocks debug1: rekey after 134217728 blocks debug1: ssh_packet_set_postauth: called debug1: active: key options: command user-rc debug1: active: forced command: "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'" debug1: Entering interactive session for SSH2. debug1: server_init_dispatch debug1: server_input_channel_open: ctype session rchan 0 win 1048576 max 16384 debug1: input_session_request debug1: channel 0: new [server-session] debug1: session_new: session 0 debug1: session_open: channel 0 debug1: session_open: session 0: link with channel 0 debug1: server_input_channel_open: confirm session debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0 debug1: server_input_channel_req: channel 0 request pty-req reply 1 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req pty-req debug1: Allocating a pty not permitted for this connection. debug1: server_input_channel_req: channel 0 request shell reply 1 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req shell Starting session: forced-command (key-option) 'F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'' for andreea from 127.0.0.1 port 50255 id 0 Environment: USER=andreea LOGNAME=andreea HOME=C:\Users\Andreea PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin MAIL=/var/spool/mail/andreea SHELL=c:\windows\system32\cmd.exe SSH_CLIENT=127.0.0.1 50255 22 SSH_CONNECTION=127.0.0.1 50255 127.0.0.1 22 debug1: Executing command: "c:\\windows\\system32\\cmd.exe" /c "F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe serv key-1 --config='F:/Gitea/custom/conf/app.ini'" with no pty debug1: server_input_channel_req: channel 0 request window-change reply 0 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req window-change debug1: server_input_channel_req: channel 0 request window-change reply 0 debug1: session_by_channel: session 0 channel 0 debug1: session_input_channel_req: session 0 req window-change debug1: Received SIGCHLD. debug1: session_by_pid: pid 8612 debug1: session_exit_message: session 0 channel 0 pid 8612 debug1: session_exit_message: release channel 0 debug1: session_by_channel: session 0 channel 0 debug1: session_close_by_channel: channel 0 child 0 Close session: user andreea from 127.0.0.1 port 50255 id 0 debug1: channel 0: free: server-session, nchannels 1 Read error from remote host 127.0.0.1 port 50255: Unknown error debug1: do_cleanup debug1: do_cleanup ```
Author
Owner

@lunny commented on GitHub (Oct 2, 2019):

Is your gitea stored F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe ?

@lunny commented on GitHub (Oct 2, 2019): Is your gitea stored `F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe` ?
Author
Owner

@ripanioan commented on GitHub (Oct 2, 2019):

Yes. This is the folder where I installed it.

@ripanioan commented on GitHub (Oct 2, 2019): Yes. This is the folder where I installed it.
Author
Owner

@ripanioan commented on GitHub (Oct 2, 2019):

Is your gitea stored F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe ?

Do you think that this issue can be related to the fact that RUN_USER configured in app.ini is the Administrator account for my machine ?

@ripanioan commented on GitHub (Oct 2, 2019): > > > Is your gitea stored `F:/Gitea/gitea-1.9.3-windows-4.0-amd64.exe` ? Do you think that this issue can be related to the fact that RUN_USER configured in app.ini is the Administrator account for my machine ?
Author
Owner

@stale[bot] commented on GitHub (Dec 1, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (Dec 1, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@lunny commented on GitHub (Dec 6, 2019):

@ripanioan Have you upgrade your gitea exe file? You should keep the same binary name. You can resync ssh keys on admin panel.

@lunny commented on GitHub (Dec 6, 2019): @ripanioan Have you upgrade your gitea exe file? You should keep the same binary name. You can resync ssh keys on admin panel.
Author
Owner

@ripanioan commented on GitHub (Dec 9, 2019):

Hi. The only way I could get it working on Windows is using embedded ssh server that Gitea has inside.
I could not make it using OpenSSH.
From what I have read. There are some problems with OpenSSH on Windows.
I think it's not a Gitea issue.

@ripanioan commented on GitHub (Dec 9, 2019): Hi. The only way I could get it working on Windows is using embedded ssh server that Gitea has inside. I could not make it using OpenSSH. From what I have read. There are some problems with OpenSSH on Windows. I think it's not a Gitea issue.
Author
Owner

@zzps commented on GitHub (Dec 24, 2019):

There are some problems with OpenSSH on Windows

I get the same problem as you . but I do not think it's not a Gitea issue. because use deepin'os clone also get the problem. so I think it is a bug of gitea

@zzps commented on GitHub (Dec 24, 2019): > There are some problems with OpenSSH on Windows I get the same problem as you . but I do not think it's not a Gitea issue. because use deepin'os clone also get the problem. so I think it is a bug of gitea
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4033