gitea icon indicating copy to clipboard operation
gitea copied to clipboard

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

Open automatize1 opened this issue 1 year ago • 1 comments
trafficstars

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://[email protected]: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

automatize1 avatar Aug 07 '24 18:08 automatize1

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.

techknowlogick avatar Aug 07 '24 21:08 techknowlogick

We close issues that need feedback from the author if there were no new comments for a month. :tea:

GiteaBot avatar Sep 17 '24 18:09 GiteaBot

Facing the same issue for me, while pushing the merge request. Any suggession or solution?

pragathiacharya avatar Sep 20 '24 08:09 pragathiacharya

Facing the same issue for me, while pushing the merge request. Any suggession or solution?

My issue was completely related to the cifs, I don't know if that's your case. My solution was to configure the cifs on the docker-compose.yml file, like so:

volumes:
  gitea-data:
    driver: local
    driver_opts:
      type: cifs
      o: username=${CIFS_USERNAME},password=${CIFS_PASSWORD},domain=${CIFS_DOMAIN},nobrl,vers=2.0,uid=1000,gid=1000,file_mode=0770,dir_mode=0770
      device: "${CIFS_DEVICE}/gitea/data"
  gitea-config:
    driver: local
    driver_opts:
      type: cifs
      o: username=${CIFS_USERNAME},password=${CIFS_PASSWORD},domain=${CIFS_DOMAIN},vers=2.0,uid=1000,gid=1000,file_mode=0770,dir_mode=0770
      device: "${CIFS_DEVICE}/gitea/config"

automatize1 avatar Sep 20 '24 14:09 automatize1