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.07k stars 5.41k forks source link

Push fails with ! [remote rejected] main -> main (pre-receive hook declined) #31798

Open automatize1 opened 1 month ago

automatize1 commented 1 month ago

Description

Much like other (closed) issues pointed out, I can't seem to push a test repo (containing only one commit regarding the creation of the README file). But unlike the closed issues, I couldn't fix the problem with the suggested approaches. This is the output on the client side:

pi@raspberrypi:~/gitea/teste $ git push -u origin main
Username for 'http://192.168.0.99:3000': gabriel.monteiro
Password for 'http://gabriel.monteiro@192.168.0.99:3000':
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 217 bytes | 217.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
To http://192.168.0.99:3000/gabriel.monteiro/teste.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'http://192.168.0.99:3000/gabriel.monteiro/teste.git'

Things I've already tried:

  1. Setting LOCAL_ROOT_URL to 127.0.0.1
  2. Deleting and recreating hooks on the repo's folder

I don't know if it helps, but here's my app.ini file:

APP_NAME = Gitea: Git with a cup of tea
RUN_USER = git
RUN_MODE = prod
WORK_PATH = /var/lib/gitea

[repository]
ROOT = /var/lib/gitea/git/repositories

[repository.local]
LOCAL_COPY_PATH = /tmp/gitea/local-repo

[repository.upload]
TEMP_PATH = /tmp/gitea/uploads

[server]
APP_DATA_PATH = /var/lib/gitea
SSH_DOMAIN = 192.168.0.99
HTTP_PORT = 3000
ROOT_URL = http://192.168.0.99:3000/
DISABLE_SSH = false
; In rootless gitea container only internal ssh server is supported
START_SSH_SERVER = true
SSH_PORT = 2222
SSH_LISTEN_PORT = 2222
BUILTIN_SSH_SERVER_USER = git
LFS_START_SERVER = true
DOMAIN = 192.168.0.99
LFS_JWT_SECRET = 18t9XG-KlFpTuTiIA_FqwLRhsOamoQYQH4vQkMB9kcU
OFFLINE_MODE = true

[database]
PATH = /var/lib/gitea/data/gitea.db
DB_TYPE = sqlite3
HOST = localhost:3306
NAME = gitea
USER = root
PASSWD = 
SCHEMA = 
SSL_MODE = disable
LOG_SQL = false

[session]
PROVIDER_CONFIG = /var/lib/gitea/data/sessions
PROVIDER = file

[picture]
AVATAR_UPLOAD_PATH = /var/lib/gitea/data/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /var/lib/gitea/data/repo-avatars

[attachment]
PATH = /var/lib/gitea/data/attachments

[log]
ROOT_PATH = /var/lib/gitea/data/log
MODE = console
LEVEL = info

[service]
DISABLE_REGISTRATION = false
REQUIRE_SIGNIN_VIEW = false
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.localhost

[lfs]
PATH = /var/lib/gitea/git/lfs

[mailer]
ENABLED = false

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

[cron.update_checker]
ENABLED = false

[repository.pull-request]
DEFAULT_MERGE_STYLE = merge

[repository.signing]
DEFAULT_TRUST_MODEL = committer

UPDATE It seems to be an issue with cifs. When I host the volumes locally on the raspberrypi, it works

Gitea Version

1.22.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

https://gist.github.com/automatize1/637a4b3f2df2c15fc9ae848a75a6cc54

Screenshots

No response

Git Version

2.39.2

Operating System

RaspberryPi OS 64

How are you running Gitea?

I'm running gitea from Docker. I guess the only uncommon configuration is that the my container volumes are hosted on another machine and accessed with cifs.

Database

SQLite

techknowlogick commented 1 month ago

Yes, cifs is tricky as sometimes pushes can fail due to disruption on the link and the hooks not executing, as well some OSes mount cifs as noexec.