go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.14k stars 5.49k forks source link

git archive wrong error if repo missed #23425

Open Abyss777 opened 1 year ago

Abyss777 commented 1 year ago

Description

I'm trying to download one file via git archive with next command:

$git archive --remote=ssh://git@gitea/soho/netbackup.git HEAD devices.db -o devices.tar.gz
Gitea: Unauthorized
fatal: the remote end hung up unexpectedly

And get next strings in trace log

2023-03-12T05:56:29.754471519Z Accepted publickey for git from 10.0.3.52 port 43900 ssh2: ED25519 SHA256:tqWVM8GRPZ5Ph9meqwBJxOBbZXSEccsXRYwmxNvIlCg

2023-03-12T05:56:30.208460819Z 2023/03/12 10:56:30 ...s/process/manager.go:171:Add() [T] [640d6971-2] Start 640d698e: GET: /api/internal/serv/command/6/soho/netbackup?mode=1&verb=git-upload-archive (request)

2023-03-12T05:56:30.208804021Z 2023/03/12 10:56:30 [640d698e] router: started   GET /api/internal/serv/command/6/soho/netbackup?mode=1&verb=git-upload-archive for 10.0.3.52:0

2023-03-12T05:56:30.227586749Z 2023/03/12 10:56:30 [640d698e] router: completed GET /api/internal/serv/command/6/soho/netbackup?mode=1&verb=git-upload-archive for 10.0.3.52:0, 403 Forbidden in 18.6ms @ private/serv.go:81(private.ServCommand)

2023-03-12T05:56:30.232637184Z 2023/03/12 10:56:30 [640d698e-2] router: started   POST /api/internal/ssh/log for 10.0.3.52:0

2023-03-12T05:56:30.232759785Z 2023/03/12 10:56:30 ...s/process/manager.go:208:remove() [T] [640d698e] Done 640d698e: GET: /api/internal/serv/command/6/soho/netbackup?mode=1&verb=git-upload-archive

2023-03-12T05:56:30.232887986Z 2023/03/12 10:56:30 ...s/process/manager.go:171:Add() [T] [640d6971-2] Start 640d698e-2: POST: /api/internal/ssh/log (request)

2023-03-12T05:56:30.233459790Z 2023/03/12 10:56:30 [640d698e-2] router: completed POST /api/internal/ssh/log for 10.0.3.52:0, 200 OK in 1.0ms @ private/ssh_log.go:18(private.SSHLog)

2023-03-12T05:56:30.233654991Z 2023/03/12 10:56:30 ...s/private/ssh_log.go:27:SSHLog() [E] [640d698e-2] ssh: Push to create is not enabled for organizations.: 

2023-03-12T05:56:30.235552404Z 2023/03/12 10:56:30 ...s/process/manager.go:208:remove() [T] [640d698e-2] Done 640d698e-2: POST: /api/internal/ssh/log

2023-03-12T05:56:30.250229004Z Received disconnect from 10.0.3.52 port 43900:11: disconnected by user

2023-03-12T05:56:30.250683307Z Disconnected from user git 10.0.3.52 port 43900

The user have read access to repository, can clone it via ssh, and download any file or archive via web.

Gitea Version

1.18.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

ubuntu 22.04

How are you running Gitea?

docker image: gitea/gitea:1.18

Database

MySQL

Abyss777 commented 1 year ago

Oh sorry, I've found my mistake. It is the misprint in repo name. The error message is visible only in TRACE log.

But still do not understand why gitea tried to "push to create" when I used git archive I believe the error should be 404 Not found or something.