Skip to content
Latchkey

Bitbucket "no basic auth credentials" (docker push)

A docker push failed because the daemon had no credentials for the registry - there was no docker login (or it used empty/wrong variables) before the push. The registry rejects the unauthenticated push.

What this error means

The push fails with "no basic auth credentials" (or denied/unauthorized). The build and tag succeeded; only the authenticated push to the registry failed.

bitbucket-pipelines
denied: requested access to the resource is denied
errors: no basic auth credentials

Common causes

No docker login before push

The push needs a prior docker login to the target registry. Without it, the daemon has no credentials and the registry denies the push.

Login variables empty or unsecured

The username/password/token variables are unset, mis-scoped, or not marked secured, so the login silently uses empty credentials.

How to fix it

Log in before pushing

Authenticate to the registry with secured variables, then push.

bitbucket-pipelines.yml
- step:
    services: [ docker ]
    script:
      - echo "\$DOCKER_PASSWORD" | docker login -u "\$DOCKER_USERNAME" --password-stdin registry.example.com
      - docker build -t registry.example.com/app:\$BITBUCKET_COMMIT .
      - docker push registry.example.com/app:\$BITBUCKET_COMMIT

Provide valid secured credentials

  1. Define DOCKER_USERNAME/DOCKER_PASSWORD (or a token) as secured variables.
  2. Confirm they are in scope for the step performing the push.
  3. Use --password-stdin so the secret is not exposed on the command line.

How to prevent it

  • Always docker login before docker push.
  • Store registry credentials as secured variables in the right scope.
  • Use --password-stdin to avoid leaking the password in logs.

Frequently asked questions

What causes ""no basic auth credentials""?
The push needs a prior docker login to the target registry. Without it, the daemon has no credentials and the registry denies the push.
How do I fix "no basic auth credentials"?
Authenticate to the registry with secured variables, then push.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card