Press Deploy Candidate Failing – Git “dubious ownership” issue inside Press Build (Ubuntu 22)

Hello Team,

I am facing a persistent issue when deploying a candidate using Frappe Press.
The build always fails at Install Apps → Frappe with this error:

fatal: detected dubious ownership in repository at '/home/frappe/context/apps/frappe/.git'
To add an exception for this directory, call:
    git config --global --add safe.directory /home/frappe/context/apps/frappe/.git
fatal: Could not read from remote repository.

This happens during:

bench init --python /usr/bin/python3.11 --no-backups --frappe-path file:///home/frappe/context/apps/frappe frappe-bench

The full build log shows:

[stage-0 20/27] RUN --mount=type=cache,target=/home/frappe/.cache ...
--mount=type=bind,source=apps/frappe,target=/home/frappe/context/apps/frappe

fatal: detected dubious ownership in repository at '/home/frappe/context/apps/frappe/.git'
CommandFailedError: git clone file:///home/frappe/context/apps/frappe --depth 1 --origin upstream

Important Details

  • All 3 servers (n1, m1, f1) are running Ubuntu 22.04 on cloud infrastructure.

  • I am only using the Frappe Press UI → I do not have access to modify Dockerfiles or .press/press.yaml.

  • The failure seems to be inside the Press Build Container because Git cannot clone the mounted apps/frappe directory due to ownership mismatch.

  • This appears to be a Press build image issue, not a configuration issue on my servers.

Below is the error issue
Setting Up Environment
$ /usr/bin/python3.11 -m venv env
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade pip==25.3
$ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet wheel
Getting frappe
$ git clone file:///home/frappe/context/apps/frappe --depth 1 --origin upstream
Cloning into ‘frappe’…
fatal: detected dubious ownership in repository at ‘/home/frappe/context/apps/frappe/.git’
To add an exception for this directory, call:

git config --global --add safe.directory /home/frappe/context/apps/frappe/.git

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
subprocess.CalledProcessError: Command ‘git clone file:///home/frappe/context/apps/frappe --depth 1 --origin upstream’ returned non-zero exit status 128.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/home/frappe/.local/lib/python3.11/site-packages/bench/commands/make.py”, line 75, in init
init(
File “/home/frappe/.local/lib/python3.11/site-packages/bench/utils/render.py”, line 105, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/home/frappe/.local/lib/python3.11/site-packages/bench/utils/system.py”, line 87, in init
get_app(
File “/home/frappe/.local/lib/python3.11/site-packages/bench/app.py”, line 779, in get_app
app.get()
File “/home/frappe/.local/lib/python3.11/site-packages/bench/utils/render.py”, line 126, in wrapper_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^
File “/home/frappe/.local/lib/python3.11/site-packages/bench/app.py”, line 202, in get
self.bench.run(
File “/home/frappe/.local/lib/python3.11/site-packages/bench/bench.py”, line 49, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise, env=env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/frappe/.local/lib/python3.11/site-packages/bench/utils/init.py”, line 184, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: git clone file:///home/frappe/context/apps/frappe --depth 1 --origin upstream

ERROR: There was a problem while creating frappe-bench

Do you want to rollback these changes? [y/N]: Aborted!
process “/bin/sh -c bench init --python /usr/bin/python${PYTHON_VERSION} --no-backups --frappe-path file:///home/frappe/context/apps/frappe frappe-bench #stage-apps-frappe” did not complete successfully: exit code: 1

[stage-0 20/27] RUN --mount=type=cache,sharing=locked,target=/home/frappe/.cache,uid=1000,gid=1000 --mount=type=bind,source=apps/frappe,target=/home/frappe/context/apps/frappe bench init --python /usr/bin/python3.11 --no-backups --frappe-path file:///home/frappe/context/apps/frappe frappe-bench #stage-apps-frappe:

self.bench.run(
File “/home/frappe/.local/lib/python3.11/site-packages/bench/bench.py”, line 49, in run
return exec_cmd(cmd, cwd=cwd or self.cwd, _raise=_raise, env=env)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/frappe/.local/lib/python3.11/site-packages/bench/utils/init.py”, line 184, in exec_cmd
raise CommandFailedError(cmd) from subprocess.CalledProcessError(return_code, cmd)
bench.exceptions.CommandFailedError: git clone file:///home/frappe/context/apps/frappe --depth 1 --origin upstream
9.887
ERROR: There was a problem while creating frappe-bench
Do you want to rollback these changes? [y/N]: Aborted!

failed to build: failed to solve: process “/bin/sh -c bench init --python /usr/bin/python${PYTHON_VERSION} --no-backups --frappe-path file:///home/frappe/context/apps/frappe frappe-bench #stage-apps-frappe” did not complete successfully: exit code: 1

1 Like