Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

A Dokku “pre-receive hook declined” message is only a summary, not the cause. Dokku rejected the Git push because a deployment hook failed somewhere in the process: your app may have exited, the image build may have failed, the host may have run out of memory, SSH identity may be wrong, or nginx may have failed to reload. Enable Dokku trace mode, reproduce the push, and use the first specific error in the complete remote log to choose the fix.

What “remote rejected master -> master (pre-receive hook declined)” actually means

During a Dokku deployment, Git sends the received objects to the Dokku host. Dokku then runs its deployment hooks to build an image, start the application process, configure the proxy and complete the release. If one of those hooks returns an error, Git reports a rejected push. The final line does not identify which hook failed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In other words, the message is compatible with an application-process problem, a buildpack or dependency failure, a network or DNS interruption, insufficient memory, an SSH authorization problem, or a late nginx reload error. Treating the Git line as a diagnosis leads to random changes. The useful evidence is the trace output immediately before the rejection.

Dokku’s troubleshooting guidance puts it plainly: “The remote rejected error does not give enough information. Anything could have failed. Enable trace mode and begin debugging.”

First response: enable tracing and capture one complete failed push

Do this before changing your Procfile, rebuilding the server or repeatedly retrying the same push.

  1. Enable Dokku trace mode using the trace setting documented for your installed Dokku version.
  2. Run the same Git push again from the repository that failed.
  3. Save all terminal output, including the lines printed before Git says the remote was rejected. Do not copy only the last one or two lines.
  4. Find the first concrete failure: an exit status, a failed download, an out-of-memory message, an SSH denial, or a sudo/nginx error. That event normally identifies the phase that needs attention.
  5. If the trace still ends in a generic rejection, preserve the complete log when asking for help. Dokku recommends including the full output in a gist or issue rather than trying to diagnose from the summary.

Trace output can be noisy. Read it chronologically: identify the phase Dokku was executing, then work on that phase only. A successful build followed by a failed proxy reload requires a different fix from a dependency download that never completed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Match the trace to the failing deployment phase

1. The web process or worker exits immediately

A container can start successfully and still cause Dokku to reject the deployment if its main process finishes before Dokku considers the release complete. The common pattern is a worker command that daemonizes itself. For example, a Procfile entry such as:

worker: bin/delayed_job start

starts a background daemon and then exits. From the container runtime’s point of view, the foreground process has ended, so the container is finished. Dokku interprets that early completion as a failed deployment even though the command may have returned cleanly.

Change the worker to a foreground command appropriate for the framework. In the documented delayed-job example, use:

worker: rake jobs:work

The important property is not the particular framework command; it is that the process remains attached to the container. Apply the equivalent foreground mode for your queue or worker system, redeploy, and confirm in the trace that the worker remains running instead of exiting immediately.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Trace clue: the container or worker ends cleanly before deployment completion.
  • Scope: normally one application’s Procfile or process definition.
  • Persistent fix: commit the foreground command and deploy that revision.

2. The image build, dependency install or buildpack step fails

When trace output points to a build failure, inspect the failed build container instead of guessing at application code. On the Dokku host, list stopped and running containers and filter for build containers:

docker ps -a | grep build

Identify the image associated with the failed build, then start it interactively:

docker run -ti IMAGE /bin/bash

Inside that environment, retry the download, package installation or build command that failed. This separates a reproducible dependency or buildpack error from a one-time network interruption and exposes the actual curl, tar, compiler or package-manager message that the final Git line hides.

Dokku identifies transient network problems and buildpack bugs as common build-phase causes. Check whether the host can reach the dependency source, resolve its DNS name and retrieve a complete archive. A partial archive can produce an extraction error that looks like an application failure. If the host’s resolver configuration changed after a network change, the Dokku documentation lists resolvconf -u as a possible corrective step before retrying.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not keep pushing unchanged commits while the same build command is failing. Capture the command and its direct error first; otherwise each retry creates another generic rejection without new evidence.

3. The host runs short of memory or swap

Dependency installation can exceed the memory available on a small Dokku host. Dokku’s advanced-installation documentation specifically notes that hosts with less than 1 GB of memory may show a pre-receive rejection while installing NPM dependencies.

Check the host for memory pressure and out-of-memory (OOM) messages at the time of the failure. If the trace or system log shows OOM evidence, add swap rather than repeatedly retrying the build. The documented example takes a 512 MB host to a 1 GB swap-backed system; the same documentation says the swap size may be increased to a maximum of twice the machine’s physical memory. Follow the swap procedure for your operating system and installation, then retry the dependency step.

  • Use swap when: the failure coincides with dependency installation and the host shows memory exhaustion or an OOM kill.
  • Do not use swap as a guess: a DNS, certificate, Procfile or permission error will not be fixed by adding memory.
  • Scope: swap changes affect the Dokku host and therefore can help multiple applications, but they also consume host storage.

4. SSH access or the selected identity is wrong

Some “pre-receive” reports are actually connection or authorization failures that happen before Dokku can deploy. If the trace contains a message such as Connection closed by <host> port 22, verify that the dokku account is permitted by /etc/security/access.conf. Correct the account’s access rule for your host’s security policy, then test the connection again.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If Git asks for a password, says the application is not a repository, or otherwise behaves as though the wrong account was selected, check the key path. The private key used by your local Git client must match the public key added to Dokku with sshcommand acl-add. A key that exists on disk but is not the one selected for this hostname will still fail authentication.

Use an SSH client configuration entry to bind the Dokku hostname to the intended identity. Dokku’s example places that mapping in ~/.ssh/config; the essential fields are the host name, the Dokku user and the exact IdentityFile containing the matching private key. Ensure the file is readable by the account running Git and that the host alias used in your Git remote matches the alias in the configuration.

  • Trace clue: the SSH connection closes, Git requests a password, or Dokku reports that the app is not a repository.
  • Scope: usually the client key, SSH configuration or Dokku access-control entry, not the application image.
  • Safety: change only the affected access rule; do not replace host-wide SSH policy with an unrestricted rule.

5. nginx reload or sudo fails after the app is already built

A deployment may complete its build and start the application, then fail at the final proxy step. One documented Dokku discussion shows nginx reload ending with:

sudo: a terminal is required to read the password

That error means the Dokku user could not run the required nginx command non-interactively. Because a Git hook has no terminal in which to type a password, the reload fails and Git receives the same pre-receive rejection even though the application itself may be healthy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Inspect the trace for the exact nginx or sudo command that failed. Correct the dokku user’s sudo permission for that required command, using the narrow rule appropriate to your installation. Do not copy an unrestricted sudo rule simply to make the error disappear. After changing the permission, repeat the push and verify that the proxy reload completes.

  • Trace clue: build and process startup succeed, followed by a sudo or nginx reload error.
  • Scope: host permission configuration; the change can affect every Dokku application that reloads nginx.
  • Recovery: retain the failed trace so you can confirm that only the intended command gained permission.

6. Slow downloads, certificate variables or DNS changes interrupt the build

For a truncated buildpack or dependency download, inspect the actual curl or tar error rather than assuming the package is bad. Dokku documents increasing the global CURL_TIMEOUT and CURL_CONNECT_TIMEOUT values when links are slow. These are host-level timeout settings, so changing them can affect other applications as well; increase them only when the trace shows a timeout or slow connection.

Also check application configuration for SSL_CERT_FILE. Dokku warns that this key can interfere with dependency downloads when it is set for an unrelated application purpose. Rename the application variable if it is not intended to point to the certificate bundle used by the downloader, then rebuild.

When DNS resolution changed on the host, the documented resolvconf -u step can regenerate resolver configuration. Verify name resolution and outbound connectivity from the build environment after making that change. A successful DNS lookup does not prove that the archive is complete, so retry the exact download and confirm its extraction succeeds.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose the smallest fix supported by the evidence

Trace evidence Likely phase Smallest relevant action Change scope
Worker/container exits before release completion Process lifecycle Replace a daemonizing Procfile command with its foreground equivalent Usually one application
Package, archive or build command reports an error Build Inspect the build container and retry the failing command interactively One build; may expose a host network issue
OOM or memory exhaustion during dependency installation Host resources Add appropriately sized swap and address memory pressure Dokku host and potentially several apps
Connection closes on port 22 or wrong-key symptoms SSH access Correct access.conf, key selection or sshcommand acl-add identity Client identity or host access policy
Sudo password prompt or nginx reload failure Proxy finalization Grant the Dokku user the narrow permission for the failed nginx command Host permission configuration
Timeout, certificate or resolver error Network/download Adjust documented curl timeouts, remove conflicting SSL_CERT_FILE use or refresh resolver settings Often host-wide settings

Verify the repair instead of trusting a successful push alone

  1. Leave trace mode enabled for the verification push so the previously failing phase is visible.
  2. Push the same revision again. A successful Git transfer is not enough if the process exits immediately after startup.
  3. Confirm that the web and worker processes remain attached and running after deployment.
  4. For a build fix, confirm the dependency or archive command completes without truncation or extraction errors.
  5. For an SSH fix, confirm Git uses the intended Dokku hostname and private key rather than falling back to a password prompt.
  6. For an nginx fix, confirm the reload command completes without a sudo password request and that the application is reachable through the proxy.
  7. Once the deployment is stable, disable trace mode if you do not need verbose hook output for further troubleshooting.

If the next push fails in a different phase, treat that as a new error. For example, correcting a build download can reveal a later process-lifecycle problem; use the new trace rather than reverting the earlier, evidence-based change.

Common mistakes that prolong the outage

  • Reading only the final Git line: it contains no phase information, so it cannot distinguish a worker exit from an nginx permission error.
  • Changing several layers at once: adding swap, editing sudoers and changing the Procfile together makes it impossible to tell which condition was responsible.
  • Running a worker as a daemon inside the container: the daemon may be healthy outside the container model while the container itself is considered finished.
  • Retrying a broken download without checking connectivity: transient DNS or network failures and buildpack bugs need different remedies.
  • Granting broad sudo access: fix the exact nginx command that failed and preserve the host’s least-privilege policy.
  • Sharing an incomplete support log: include the complete remote output so the failing hook and its preceding command are visible.

When to escalate with a Dokku issue

Escalate after trace mode still does not identify a concrete failing command, or after the same command fails reproducibly despite the documented correction for its phase. Include the complete push output, the phase in which it stops, the relevant Procfile entry or configuration key, and whether the host showed memory, DNS, SSH or sudo errors. Redact private keys, tokens and other secrets, but do not remove the command and exit-status lines that explain the rejection.

The useful question is not “Why did Git reject master?” It is “Which Dokku hook failed, under what host conditions, and what does its first specific error say?” Answering that from a trace turns the generic pre-receive message into a targeted repair.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.