Skip to content

git clone via ssh fails when running task as non-root #85

@hudac

Description

@hudac

Issue

When running the task as non-root, as in task/git-clone/git-clone.yaml:

securityContext:
  runAsNonRoot: true
  runAsUser: 65532

It will fail when cloning a repo via SSH:

Error running git [fetch --recurse-submodules=yes ...]: exit status 128\nNo user exists for uid 65532\r\nfatal: Could not read from remote repository...

The reason is that SSH expects the user to exist, i.e. in /etc/passwd, see openssh.

Reproduce

docker run -u 65532 --rm -it --entrypoint=sh ghcr.io/tektoncd-catalog/git-clone:v1.2.0 -c "ssh -vvv git@github.com"

will fail with:

No user exists for uid 65532

Workaround

Run task as root (remove the securityContext).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions