Push error: "line 2: /app/gitea/gitea: No such file or directory"

Hi everyone,

I am trying to get started with gitea on a raspberry 2 W. For this I am using an image for docker, found here: Docker

this is my compose file:

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: kunde21/gitea-arm:latest
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=postgres
      - GITEA__database__HOST=db:5432
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea
    restart: always
    volumes:
      - ./data:/var/lib/gitea
      - ./config:/etc/gitea
      - myvolume:/piffpaff
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "80:3000"
      - "23:2222"
    depends_on:
      - db
    networks:
      - gitea

  db:
    image: postgres:14
    restart: always
    environment:
      - POSTGRES_USER=gitea
      - POSTGRES_PASSWORD=gitea
      - POSTGRES_DB=gitea
    networks:
      - gitea
    volumes:
      - ./postgres:/var/lib/postgresql/data

volumes:
  myvolume:
    driver: local
    driver_opts:
      type: none
      o: bind
      device: /media/usbdrv/

I can start the image, import the repositries I have created with git and see the content. I can clone the repositories created with gitea.
But I can’t push. The error message contains one line I can’t figure out:

remote: ./hooks/pre-receive.d/gitea: line 2: /app/gitea/gitea: No such file or directory

(more context)

To remote:/media/usbdrv/thomas/testme.git
 ! [remote rejected] newBranch -> newBranch (pre-receive hook declined)
error: failed to push some refs to 'remote:/media/usbdrv/thomas/testme.git'

When I look into the file system the gitea binary is found exactly there and nothing else. Also I am running gitea and can login, create users and so on.
I have registered my public key in gitea, but the name is “thomas@home.git” - I hope this is no issue?

I have searched the web and none of the suggestions I found were helpful. (especially executing “Resynchronize pre-receive, update and post-receive hooks of all repositories.” from Dashboard)
This is my current App.ini (some things omitted, which are irrelvant):

APP_NAME = Gitea: Git with a cup of tea
RUN_MODE = prod
RUN_USER = git

[repository]
ROOT = /piffpaff

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

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

[server]
APP_DATA_PATH    = /data/gitea
DOMAIN           = localhost
SSH_DOMAIN       = localhost
HTTP_PORT        = 3000
ROOT_URL         = http://localhost:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
SSH_LISTEN_PORT  = 22
LFS_START_SERVER = true
LFS_CONTENT_PATH = /data/git/lfs
LFS_JWT_SECRET   = ...omittted...
OFFLINE_MODE     = false
LOCAL_ROOT_URL   = http://localhost:80

[database]
PATH     = /data/gitea/gitea.db
DB_TYPE  = postgres
HOST     = db:5432
NAME     = gitea
USER     = gitea
PASSWD   = gitea
LOG_SQL  = false
SCHEMA   =
SSL_MODE = disable
CHARSET  = utf8

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

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

[picture]
AVATAR_UPLOAD_PATH            = /data/gitea/avatars
REPOSITORY_AVATAR_UPLOAD_PATH = /data/gitea/repo-avatars
DISABLE_GRAVATAR              = false
ENABLE_FEDERATED_AVATAR       = true

[attachment]
PATH = /data/gitea/attachments

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

[security]
INSTALL_LOCK                  = true
SECRET_KEY                    = ...omittted...
REVERSE_PROXY_LIMIT           = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
INTERNAL_TOKEN                = ...omittted...
PASSWORD_HASH_ALGO            = pbkdf2

[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

[mailer]
ENABLED = false

[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true

Hi,

In your app.ini you have all paths (except repo root) set to /data/..., but your service has no volume attached there.
Could that be what’s tripping it up?

Hi TjvV,
I don’t that’s the case.

Nevertheless I’ve now started over, using the new raspberry image (bookworm) as ARM64 variant without desktop.
I once again installed docker and docker-compose. I also pulled gitea 1.21-rc1 and started -everything fine.
With this installation I am one step further, since I can push to repositories that were created with gitea.

Edit:
I’ve found that deleting post-receive.d pre-receive.d proc-receive.d update.d resolves the issue not being able to push, though the message remains. But another issue emerges: new branches, that are pushed to remote do not appear in gitea. renaming the repository folder twice (eg. foo.git → foo.mv → foo.git), so that gitea reads the branches again, helps.

But every imported repository leads to the same isse:

remote: ./hooks/pre-receive.d/gitea: line 3: /usr/local/bin/gitea: No such file or directory
To 192.168.0.142:/home/thomas/usbdrv/repositories/thomas/foome.git/
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'remote:/home/thomas/usbdrv/repositories/thomas/foome.git/'

using this compose file:

version: "3"

networks:
  gitea:
    external: false

volumes:
  giteadata:
    driver_opts:
      o: bind
      type: none
      device: /home/thomas/usbdrv/gitea
  repos:
    driver_opts:
      o: bind
      type: none
      device: /home/thomas/usbdrv/repositories

services:
  server:
    image: gitea/gitea:1.21.0-rc1
    container_name: gitea
    environment:
      - USER=thomas
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    networks:
      - gitea
    volumes:
      - repos:/data/repositories
      - giteadata:/data/gitea
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"

with this app.ini:

APP_NAME = Gitea: Git with a cup of tea
RUN_MODE = prod
RUN_USER = thomas
WORK_PATH = /data/gitea

[repository]
ROOT = /data/repositories
ENABLE_PUSH_CREATE_USER = true

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

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

[server]
APP_DATA_PATH = /data/gitea
DOMAIN = [0]
SSH_DOMAIN = [0]
HTTP_PORT = 3000
ROOT_URL = http://[0]:3000/
DISABLE_SSH = false
SSH_PORT = 22
SSH_LISTEN_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET =  ...omitted...
OFFLINE_MODE = false

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

[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve

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

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

[attachment]
PATH = /data/gitea/attachments

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

[security]
INSTALL_LOCK = true
SECRET_KEY =
REVERSE_PROXY_LIMIT = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
INTERNAL_TOKEN =  ...omitted...
PASSWORD_HASH_ALGO = pbkdf2
IMPORT_LOCAL_PATHS = true

[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 = /data/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

[oauth2]
JWT_SECRET = ...omitted...

I got it: tricked myself.

Since I was setting remote to the directory where the .git folder is located I was able to push via ssh. The pre-receive hook was declined after pushing the button in administration, where I couldn’t find any difference between an imported repo and one created by gitea.
Actually the issue is that pushing via ssh meant to push via port 22, totally ignoring the gitea config, in which port 222 is set as external port.
Configuring the remote paths in my local repositories to use the gitea path now allows to push, without any issue (despite the zero 2 W 1 Ghz core being a little underpowered, resulting in a 5 - 15 sec. delay).

Anyone reading this: check your configuration and remote paths for using the gitea connection. The hooks issue one can find googling is resolved in gitea since quite some versions and not related to the root cause of this topic.

If someone needs help configuring the remote addresses, try to clone a repository with the HTTP link, use git remote -v and adapt other repositories with this knowlegde.

1 Like