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
44.71k stars 5.46k forks source link

404 Not Found when doing git push ( return code 22 ) #7379

Closed dtouzeau closed 5 years ago

dtouzeau commented 5 years ago

Description

I have created the first repository but when i want to push the nginx return a 404

NgInx events: 176.187.150.8 - - [08/Jul/2019:13:58:37 +0000] "GET /ArticaTech/artica3x.git/info/refs?service=git-receive-pack HTTP/1.1" 401 0 "-" "git/1.7.0.4" 176.187.150.8 - - [08/Jul/2019:13:58:38 +0000] "GET /ArticaTech/artica3x.git/info/refs HTTP/1.1" 200 59 "-" "git/1.7.0.4" 176.187.150.8 - - [08/Jul/2019:13:58:38 +0000] "GET /ArticaTech/artica3x.git/HEAD HTTP/1.1" 404 8146 "-" "git/1.7.0.4" 176.187.150.8 - - [08/Jul/2019:13:58:38 +0000] "PROPFIND /ArticaTech/artica3x.git/ HTTP/1.1" 404 8058 "-" "git/1.7.0.4"

Log on Client :

GIT_CURL_VERBOSE=1 git push origin master --force

< HTTP/1.1 200 OK < Server: nginx < Date: Mon, 08 Jul 2019 14:04:42 GMT < Content-Type: text/plain; charset=utf-8 < Content-Length: 59 < Connection: keep-alive < Accept-Ranges: bytes < Cache-Control: no-cache, max-age=0, must-revalidate < Expires: Fri, 01 Jan 1980 00:00:00 GMT < Last-Modified: Mon, 08 Jul 2019 14:04:42 GMT < Pragma: no-cache < Set-Cookie: lang=en-US; Path=/; Max-Age=2147483647 < Set-Cookie: i_like_gitea=165a249097ea918c; Path=/; HttpOnly < Set-Cookie: _csrf=W9W7ymz6Lm9poyvkQ9BluxMyNNM6MTU2MjU5NDY4Mjk4NjEzNjU4MA%3D%3D; Path=/; Expires=Tue, 09 Jul 2019 14:04:42 GMT; HttpOnly < X-Frame-Options: SAMEORIGIN < X-Content-Type-Options: nosniff <

< HTTP/1.1 100 Continue

Cherrg commented 5 years ago

is it possible to update to a newer version of gitea?

zeripath commented 5 years ago

Please do not use Gitea <1.7.6 as there are serious security vulnerabilities in those early versions

dtouzeau commented 5 years ago

Upgraded to 1.10.0+dev built with GNU Make 4.1, go1.12.6 : bindata, sqlite, sqlite_unlock_notify But same 404 not found error

techknowlogick commented 5 years ago

You've provided the nginx log, but what does Gitea say?

lunny commented 5 years ago

Maybe you should check your file system permission on this repository because /ArticaTech/artica3x.git/info/refs return 200, but /ArticaTech/artica3x.git/HEAD return 404.

dtouzeau commented 5 years ago

The nGNIX run as the same git user to avoid permissions issues:

git      23676  0.0  0.3 211084  3220 ?        S    07:32   0:00 nginx: worker process
git      23677  0.0  0.3 211084  3220 ?        S    07:32   0:00 nginx: worker process
git      23678  0.0  0.3 211084  3220 ?        S    07:32   0:00 nginx: worker process
git      23679  0.0  0.3 211084  3220 ?        S    07:32   0:00 nginx: worker process
git      23680  0.0  0.3 211084  3220 ?        S    07:32   0:00 nginx: worker process
git      23681  0.0  0.6 211156  6960 ?        S    07:32   0:00 nginx: worker process
git      23682  0.0  0.3 211084  3220 ?        S    07:32   0:00 nginx: worker process
git      23683  0.0  0.3 211084  3220 ?        S    07:32   0:00 nginx: worker process
git      23685  0.0  0.3 211084  3224 ?        S    07:32   0:00 nginx: worker process
git      23686  0.0  0.3 211084  3224 ?        S    07:32   0:00 nginx: worker process
git      23690  0.0  0.5 211084  5276 ?        S    07:32   0:00 nginx: worker process
git      23691  0.0  0.6 211424  6976 ?        S    07:32   0:00 nginx: worker process
git      23803  0.0 11.7 898632 123276 ?       Ssl  07:32   0:00 /home/git/gitea web -c /etc/gitea/app.ini

Here the gita in debug mode when trying to push

2019/07/09 07:39:52 models/models.go:305:NewEngine() [W] Table protected_branch Column can_push db default is 0, struct default is false
2019/07/09 07:39:52 models/models.go:305:NewEngine() [W] Table protected_branch Column enable_merge_whitelist db default is 0, struct default is false
2019/07/09 07:39:52 models/models.go:305:NewEngine() [W] Table user_open_id Column show db default is 0, struct default is false
2019/07/09 07:39:52 models/models.go:305:NewEngine() [W] Table review column type db type is VARCHAR(255), struct type is INT
2019/07/09 07:39:52 models/models.go:305:NewEngine() [W] Table comment has column old_assignee_id but struct has not related field
2019/07/09 07:39:52 routers/init.go:84:GlobalInit() [I] ORM engine initialization successful!
2019/07/09 07:39:52 routers/init.go:106:GlobalInit() [I] SQLite3 Supported
2019/07/09 07:39:52 routers/init.go:37:checkRunMode() [I] Run Mode: Production
2019/07/09 07:39:52 cmd/web.go:151:runWeb() [I] Listen: unix:///home/git/run/gitea.sock
2019/07/09 07:39:52 cmd/web.go:154:runWeb() [I] LFS server enabled
2019/07/09 07:40:27 ...s/context/context.go:315:func1() [D] Session ID: 671307434f255abe
2019/07/09 07:40:27 ...s/context/context.go:316:func1() [D] CSRF Token: AQLp6iN9Sw0C5XSmSU4frXp_2co6MTU2MjY1ODAyNzkyNDQ0OTk3OQ==
2019/07/09 07:40:28 ...s/context/context.go:315:func1() [D] Session ID: 7e9a2f9edcf9fcea
2019/07/09 07:40:28 ...s/context/context.go:316:func1() [D] CSRF Token: dnGU2lx4dGAYIaDbfznD_z5GSvc6MTU2MjY1ODAyODI5NzcxNDUwMQ==
2019/07/09 07:40:28 ...s/context/context.go:315:func1() [D] Session ID: b79278bd8c4fa723
2019/07/09 07:40:28 ...s/context/context.go:316:func1() [D] CSRF Token: -RlF7l5EeXyq_vb_4P8Ha8YPBxs6MTU2MjY1ODAyODM4NDI1OTI2Mg==
2019/07/09 07:40:28 ...s/context/context.go:137:HTML() [D] Template: status/404
2019/07/09 07:40:29 ...s/context/context.go:315:func1() [D] Session ID: 9bdae8a1e0e33b62
2019/07/09 07:40:29 ...s/context/context.go:316:func1() [D] CSRF Token: -d78qd3TZq_R5hu_qsz7EIlS6qk6MTU2MjY1ODAyOTE1MTYyNzE5Mw==
2019/07/09 07:40:29 ...s/context/context.go:137:HTML() [D] Template: status/404
dtouzeau commented 5 years ago

Any help ?

zeripath commented 5 years ago

Have you checked your filesystem permissions?

dtouzeau commented 5 years ago

The nginx service and gita run on the same user

Here permissions on the folder

total 40K
drwxr-xr-x 7 git git 4.0K Jul  8 15:27 .
drwxr-xr-x 4 git git 4.0K Jul  8 15:27 ..
-rwxr-xr-x 1 git git   23 Jul  8 15:27 HEAD
drwxr-xr-x 2 git git 4.0K Jul  8 15:27 branches
-rwxr-xr-x 1 git git   66 Jul  8 15:27 config
-rwxr-xr-x 1 git git   73 Jul  8 15:27 description
drwxr-xr-x 5 git git 4.0K Jul  8 15:27 hooks
drwxr-xr-x 2 git git 4.0K Jul  9 07:40 info
drwxr-xr-x 7 git git 4.0K Jul  8 15:27 objects
drwxr-xr-x 4 git git 4.0K Jul  8 15:27 refs
zeripath commented 5 years ago

Ah. Ok so I see you're sending propfind messages - that makes me suspicious. What version of git is your client and on the server?

dtouzeau commented 5 years ago

Client: 1.7.0.4 Server: 1.10.0+dev

zeripath commented 5 years ago

Ok if you're sure you have the URLs correct could you try with a more up to date version of git. PROPFIND implies that you're trying to use WebDAV to get over http rather than smart git.

dtouzeau commented 5 years ago

Upgraded the Git client to : 2.3.7

Working like a charme..

Thanks to all.