Gitea refuses SSH connections when using valid public keys #5929

Closed
opened 2025-11-02 06:40:36 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @bkraul on GitHub (Aug 31, 2020).

  • Gitea version (or commit ref): afd89b1 (and 58f57b3)
  • Git version: 1.13.0+dev-496
  • Operating system:
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL): N/A, SSH issue.
    • No
    • Not relevant
  • Log gist:

Description

Commits afd89b1 (and 58f57b3) have an issue where all public SSH keys are rejected. This does not happen with commit f8601f3. I have been able to test this on try.gitea.io, and this is the error I get:

git clone git@try.gitea.io:bkraul/TestProject.git
Cloning into 'TestProject'...
fatal: 'bkraul/TestProject.git' does not appear to be a git repository
Gitea: Internal error
Failed to execute git command: exit status 128
fatal: Could not read from remote repository.

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

The repository does exist and the public SSH key is valid.

Screenshots

image
image

Originally created by @bkraul on GitHub (Aug 31, 2020). <!-- 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): afd89b1 (and 58f57b3) - Git version: 1.13.0+dev-496 - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL): N/A, SSH issue. - [ ] No - [ ] Not relevant - Log gist: ## Description Commits afd89b1 (and 58f57b3) have an issue where all public SSH keys are rejected. This does not happen with commit f8601f3. I have been able to test this on try.gitea.io, and this is the error I get: ``` git clone git@try.gitea.io:bkraul/TestProject.git Cloning into 'TestProject'... fatal: 'bkraul/TestProject.git' does not appear to be a git repository Gitea: Internal error Failed to execute git command: exit status 128 fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ``` The repository does exist and the public SSH key is valid. ## Screenshots ![image](https://user-images.githubusercontent.com/14616851/91740205-949ad780-eb78-11ea-8efe-3f16953b2676.png) ![image](https://user-images.githubusercontent.com/14616851/91740273-b300d300-eb78-11ea-92d2-d9c4251d0f15.png)
Author
Owner

@zeripath commented on GitHub (Aug 31, 2020):

Without logs we cannot assess further. We need the logs from the running gitea server.

@zeripath commented on GitHub (Aug 31, 2020): Without logs we cannot assess further. We need the logs from the running gitea server.
Author
Owner

@bkraul commented on GitHub (Aug 31, 2020):

This was done on try.gitea.io. I can send you mine, but I don't see much on there, tbh.

@bkraul commented on GitHub (Aug 31, 2020): This was done on try.gitea.io. I can send you mine, but I don't see much on there, tbh.
Author
Owner

@bkraul commented on GitHub (Aug 31, 2020):

This is all I get. These are 2 tries to do a git pull action (some info modified for privacy):

Server listening on :: port 22.
Server listening on 0.0.0.0 port 22.
2020/08/31 11:04:51 cmd/web.go:108:runWeb() [I] Starting Gitea on PID: 17
2020/08/31 11:04:51 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.26.2, Wire Protocol Version 2 Enabled
2020/08/31 11:04:51 routers/init.go:123:GlobalInit() [T] AppPath: /app/gitea/gitea
2020/08/31 11:04:51 routers/init.go:124:GlobalInit() [T] AppWorkPath: /app/gitea
2020/08/31 11:04:51 routers/init.go:125:GlobalInit() [T] Custom path: /data/gitea
2020/08/31 11:04:51 routers/init.go:126:GlobalInit() [T] Log path: /data/gitea/log
Accepted publickey for git from 192.168.0.x port 61025 ssh2: RSA SHA256:******************
[Macaron] 2020-08-31 11:05:19: Started GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack for 127.0.0.1
[Macaron] 2020-08-31 11:05:19: Completed GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack 200 OK in 11.462804ms
Received disconnect from 192.168.0.x port 61025:11: disconnected by user
Disconnected from user git 192.168.0.x port 61025
Accepted publickey for git from 192.168.0.x port 61036 ssh2: RSA SHA256:***************
[Macaron] 2020-08-31 11:06:46: Started GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack for 127.0.0.1
[Macaron] 2020-08-31 11:06:46: Completed GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack 200 OK in 10.37227ms
Received disconnect from 192.168.0.x port 61036:11: disconnected by user
Disconnected from user git 192.168.0.x port 61036
@bkraul commented on GitHub (Aug 31, 2020): This is all I get. These are 2 tries to do a `git pull` action (some info modified for privacy): ``` Server listening on :: port 22. Server listening on 0.0.0.0 port 22. 2020/08/31 11:04:51 cmd/web.go:108:runWeb() [I] Starting Gitea on PID: 17 2020/08/31 11:04:51 ...dules/setting/git.go:93:newGit() [I] Git Version: 2.26.2, Wire Protocol Version 2 Enabled 2020/08/31 11:04:51 routers/init.go:123:GlobalInit() [T] AppPath: /app/gitea/gitea 2020/08/31 11:04:51 routers/init.go:124:GlobalInit() [T] AppWorkPath: /app/gitea 2020/08/31 11:04:51 routers/init.go:125:GlobalInit() [T] Custom path: /data/gitea 2020/08/31 11:04:51 routers/init.go:126:GlobalInit() [T] Log path: /data/gitea/log Accepted publickey for git from 192.168.0.x port 61025 ssh2: RSA SHA256:****************** [Macaron] 2020-08-31 11:05:19: Started GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack for 127.0.0.1 [Macaron] 2020-08-31 11:05:19: Completed GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack 200 OK in 11.462804ms Received disconnect from 192.168.0.x port 61025:11: disconnected by user Disconnected from user git 192.168.0.x port 61025 Accepted publickey for git from 192.168.0.x port 61036 ssh2: RSA SHA256:*************** [Macaron] 2020-08-31 11:06:46: Started GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack for 127.0.0.1 [Macaron] 2020-08-31 11:06:46: Completed GET /api/internal/serv/command/11/bkraul/project?mode=1&verb=git-upload-pack 200 OK in 10.37227ms Received disconnect from 192.168.0.x port 61036:11: disconnected by user Disconnected from user git 192.168.0.x port 61036 ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5929