Skip to content

Git warning being displayed when building in a git directory with no commits yet #1587

@ciaranmcnulty

Description

@ciaranmcnulty

Encountered with buildx: Docker Buildx (Docker Inc., v0.10.0)

To reproduce (in a new dir):

git init
echo "FROM scratch" > Dockerfile
docker buildx build .

Output:

 => [internal] load build definition from Dockerfile                       0.0s
 => => transferring dockerfile: 50B                                        0.0s
 => [internal] load .dockerignore                                          0.0s
 => => transferring context: 2B                                            0.0s
 => exporting to image                                                     0.0s
 => => writing image sha256:54ac6bb475f018dd78804ac491a2dc0e0e3331f8b6347  0.0s
WARNING: failed to get git commit: fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions