GeezerVison is showing github.com — ADD Cannot be Used to Add Public Git Repos Because The Action Fails With An Error · Issue #351 · docker/bake-action
ADD Cannot be Used to Add Public Git Repos Because The Action Fails With An Error #351DescriptionContributing guidelines
I've found a bug, and:
- The documentation does not mention anything about my problem
- There are no open or closed issues that are related to my problem
Description
When I try to build a Dockerfile with an ADD instruction pointing to a public Git repository using this action, I get the error fatal: could not read Username for 'https://gitlab.com/': terminal prompts disabled.
Expected behaviour
The action should properly be able to build the Dockerfile by executing the ADD command.
Actual behaviour
The action errors out with fatal: could not read Username for 'https://gitlab.com/': terminal prompts disabled.
Repository URL
https://github.com/JLP04/docker-elevation-generator
Workflow run URL
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062
YAML workflow
name: ci-pr
on:
push:
branches:
- main
pull_request:
env:
IMAGE_NAME: ***/elevation-generator
GITHUB_IMAGE_NAME: ghcr.io/***/elevation-generator
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.platforms.outputs.matrix }}
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Checkout Repo
uses: actions/checkout@v5
- name: Create matrix
id: platforms
run: |
echo "matrix=$(docker buildx bake --print | jq -cr '.target."default".platforms')" >>${GITHUB_OUTPUT}
- name: Show matrix
run: |
echo ${{ steps.platforms.outputs.matrix }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GITHUB_IMAGE_NAME }}
- name: Rename meta bake definition file
run: |
mv "${{ steps.meta.outputs.bake-file }}" "${{ runner.temp }}/bake-meta.json"
- name: Upload meta bake defintion
uses: actions/upload-artifact@v4
with:
name: bake-meta
path: ${{ runner.temp }}/bake-meta.json
if-no-files-found: error
retention-days: 1
build:
needs:
- prepare
strategy:
fail-fast: false
matrix:
platform: ${{ fromJson(needs.prepare.outputs.matrix) }}
include:
- os: ubuntu-latest
- os: ubuntu-24.04-arm
platform: linux/arm/v5
- os: ubuntu-24.04-arm
platform: linux/arm/v7
- os: ubuntu-24.04-arm
platform: linux/arm64/v8
- os: ubuntu-24.04-arm
platform: linux/ppc64le
- os: ubuntu-24.04-arm
platform: linux/riscv64
- os: ubuntu-24.04-arm
platform: linux/s390x
runs-on: ${{ matrix.os }}
permissions:
packages: write
steps:
- name: Free Up Space
uses: jlumbroso/[email protected]
with:
tool-cache: true
- name: Free Up More Space
run: |
sudo rm -rf /usr/local/share/powershell /usr/share/swift /usr/lib/jvm || true
sudo apt autoremove -y
sudo apt clean
- name: Clean Old Package Config
run: sudo apt purge -y '~c'
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
- name: Download meta bake definition
uses: actions/download-artifact@v4
with:
name: bake-meta
path: ${{ runner.temp }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Checkout Repo
uses: actions/checkout@v5
- name: Get Git commit timestamps
run: echo "TIMESTAMP=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- name: Get Git Indeterminate Branch
run: echo "BRANCH_END=$(git ls-remote --heads "https://gitlab.com/flightgear/flightgear.git" | sed -nEe 's@.*[ \t]+refs/heads/release/([^ \t]+)@\1@p' | sort -t . -k 1,1n -k2,2n -k3,3n | tail -1 | tr -d '\n')" >> $GITHUB_ENV
- name: Validate build configuration
uses: docker/bake-action@v6
with:
targets: validate-build
set: "default.args.branch_end=${{ env.BRANCH_END }}"
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Build
id: bake
uses: docker/bake-action@v6
with:
files: |
./docker-bake.hcl
cwd://${{ runner.temp }}/bake-meta.json
targets: default
set: |
default.args.branch_end=${{ env.BRANCH_END }}
default.tags=${{ env.GITHUB_IMAGE_NAME }}
*.platform=${{ matrix.platform }}
*.output=type=image,push-by-digest=true,name-canonical=true
push: true
provenance: true
sbom: true
env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
- name: Export digest
run: |
mkdir -p ${{ runner.temp }}/digests
digest="${{ fromJSON(steps.bake.outputs.metadata).default['containerimage.digest'] }}"
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
if-no-files-found: error
retention-days: 1
merge:
runs-on: ubuntu-latest
permissions:
packages: write
needs:
- build
steps:
- name: Download meta bake definition
uses: actions/download-artifact@v4
with:
name: bake-meta
path: ${{ runner.temp }}
- name: Download digests
uses: actions/download-artifact@v4
with:
path: ${{ runner.temp }}/digests
pattern: digests-*
merge-multiple: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
- name: Create manifest list and push
working-directory: ${{ runner.temp }}/digests
run: |
docker buildx imagetools create $(jq -cr '.target."docker-metadata-action".tags | map(select(startswith("${{ env.GITHUB_IMAGE_NAME }}")) | "-t " + .) | join(" ")' ${{ runner.temp }}/bake-meta.json) \
$(printf '${{ env.GITHUB_IMAGE_NAME }}@sha256:%s ' *)
Workflow logs
logs_45309579880.zip
BuildKit logs
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190300250#step:19:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320707#step:31:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320661#step:31:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320703#step:31:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320695#step:31:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320698#step:31:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320726#step:31:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320690#step:31:2
https://github.com/JLP04/docker-elevation-generator/actions/runs/17659617062/job/50190320705#step:31:2
Additional info
I'm aware this bug may not be fixable due to the nature of GitHub Actions but I figured I'd open a ticket in case it is. Activitycrazy-max commented on Sep 29, 2025 I looked at your Dockerfile: https://github.com/JLP04/docker-elevation-generator/blob/e78c32668f58752534de7b32ac09b6ece3e62889/Dockerfile#L63
ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
And the logs:
> [build 22/32] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null:
0.028 Initialized empty Git repository in /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/4/fs/
0.257 fatal: could not read Username for 'https://gitlab.com/': terminal prompts disabled
But could not repro locally on my side with:
FROM alpine
ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
RUN echo hello
#5 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#5 0.083 Initialized empty Git repository in /var/lib/desktop-containerd/daemon/io.containerd.snapshotter.v1.overlayfs/snapshots/13176/fs/
#5 0.747 b5895abe0d94a57839929d38b5681dc8e796a8a0 refs/heads/release/2024-build
#5 1.934 From https://gitlab.com/flightgear/openscenegraph
#5 1.934 * [new branch] release/2024-build -> refs/heads/release/2024-build
#5 1.935 * [new branch] release/2024-build -> origin/release/2024-build
#5 DONE 3.1s
#6 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#6 merging
#6 merging 0.3s done
#6 DONE 0.8s
#7 [3/3] RUN echo hello
#7 0.315 hello
#7 DONE 0.6s
I will check in GHA and keep you posted. crazy-max commented on Sep 29, 2025 Seems to work fine with GHA:
name: bakeaction-351
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build
uses: docker/bake-action@master
with:
source: .
workdir: ./bakeaction-351
docker-bake.hcl:
FROM alpine
ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
RUN echo hello
Logs:
#0 building with "builder-96e1125f-ef7f-4374-a516-06f0c2360d56" instance using docker-container driver
#1 [internal] load local bake definitions
#1 reading docker-bake.hcl 19B / 19B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 159B done
#2 DONE 0.0s
#3 [auth] library/alpine:pull token for registry-1.docker.io
#3 DONE 0.0s
#4 [internal] load metadata for docker.io/library/alpine:latest
#4 DONE 0.6s
#5 [internal] load .dockerignore
#5 transferring context: 2B done
#5 DONE 0.0s
#6 [1/3] FROM docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
#6 resolve docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 done
#6 DONE 0.0s
#7 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#7 0.015 Initialized empty Git repository in /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/3/fs/
#7 0.434 b5895abe0d94a57839929d38b5681dc8e796a8a0 refs/heads/release/2024-build
#7 1.516 From https://gitlab.com/flightgear/openscenegraph
#7 1.516 * [new branch] release/2024-build -> refs/heads/release/2024-build
#7 1.517 * [new branch] release/2024-build -> origin/release/2024-build
#7 DONE 2.4s
#8 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#8 DONE 0.4s
#6 [1/3] FROM docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
#6 sha256:9824c27679d3b27c5e1cb00a73adb6f4f8d556994111c12db3c5d61a0c843df8 3.80MB / 3.80MB 0.1s done
#6 DONE 0.2s
#8 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#8 extracting sha256:9824c27679d3b27c5e1cb00a73adb6f4f8d556994111c12db3c5d61a0c843df8 0.1s done
#8 merging
#8 merging 0.4s done
#8 DONE 0.8s
#9 [3/3] RUN echo hello
#9 0.046 hello
#9 DONE 0.1s
#10 resolving provenance for metadata file
#10 DONE 0.0s
I also could not repro with your full Dockerfile: https://github.com/JLP04/docker-elevation-generator/blob/e78c32668f58752534de7b32ac09b6ece3e62889/Dockerfile
It fails later with:
#57 [build 21/32] ADD --link https://gitlab.com/flightgear/fgdata.git?branch=release/2024.1 /dev/null
#57 CACHED
#58 [run 6/13] COPY --from=build-go /croc-v10.2.4/croc_v10.2.4_Linux-unknown.tar.gz /v10.2.4/
#58 ERROR: failed to calculate checksum of ref v0bcaydzmj4u9pvv9wvrnz1ae::pqxyi57bbwc11c9memz52bkiv: "/croc-v10.2.4/croc_v10.2.4_Linux-unknown.tar.gz": not found
#59 [run 7/13] COPY --from=build-go /croc-v10.2.4/croc_v10.2.4_checksums.txt /v10.2.4/
#59 ERROR: failed to calculate checksum of ref v0bcaydzmj4u9pvv9wvrnz1ae::pqxyi57bbwc11c9memz52bkiv: "/croc-v10.2.4/croc_v10.2.4_checksums.txt": not found
Wonder if this is something flaky with GitLab.
Btw I have a question about: https://github.com/JLP04/docker-elevation-generator/blob/e78c32668f58752534de7b32ac09b6ece3e62889/Dockerfile#L51-L63
ADD --link https://github.com/c-ares/c-ares.git#v1.34 /dev/null
ADD --link https://git.code.sf.net/p/libplib/code.git#master /dev/null
ARG branch_end=2024.1
ADD --link https://gitlab.com/flightgear/simgear.git?branch=release/${branch_end} /dev/null
ADD --link https://gitlab.com/flightgear/flightgear.git?branch=release/${branch_end} /dev/null
ADD --link https://gitlab.com/flightgear/fgdata.git?branch=release/${branch_end} /dev/null
ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
What's the point of cloning to /dev/null?
Closing in the meantime. JLP04 commented on Sep 30, 2025
Seems to work fine with GHA:
Hmmm, maybe the version of something got updated and it fixed it, I'll have to try again at some point (some other parts of my actions workflows need tweaking anyway)
What's the point of cloning to /dev/null?
The download_and_compile.sh script that it runs later on in the build clones all of those, so I put it in there so that if the repos were updated, it would hopefully cause a cache miss and cause download_and_compile.sh to be run, so it would update the versions it cloned. At the same time, I didn't need the second copy of each repo to take up space in the container, either during the build process or in the finished product. JLP04 commented on Oct 3, 2025
Seems to work fine with GHA:
name: bakeaction-351
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v5
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug
-
name: Build
uses: docker/bake-action@master
with:
source: .
workdir: ./bakeaction-351
docker-bake.hcl:
target "default" {}
FROM alpine
ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
RUN echo hello
Logs:
```
#0 building with "builder-96e1125f-ef7f-4374-a516-06f0c2360d56" instance using docker-container driver
#1 [internal] load local bake definitions
#1 reading docker-bake.hcl 19B / 19B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 159B done
#2 DONE 0.0s
#3 [auth] library/alpine:pull token for registry-1.docker.io
#3 DONE 0.0s
#4 [internal] load metadata for docker.io/library/alpine:latest
#4 DONE 0.6s
#5 [internal] load .dockerignore
#5 transferring context: 2B done
#5 DONE 0.0s
#6 [1/3] FROM docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
#6 resolve docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1 done
#6 DONE 0.0s
#7 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#7 0.015 Initialized empty Git repository in /var/lib/buildkit/runc-overlayfs/snapshots/snapshots/3/fs/
#7 0.434 b5895abe0d94a57839929d38b5681dc8e796a8a0 refs/heads/release/2024-build
#7 1.516 From https://gitlab.com/flightgear/openscenegraph
#7 1.516 * [new branch] release/2024-build -> refs/heads/release/2024-build
#7 1.517 * [new branch] release/2024-build -> origin/release/2024-build
#7 DONE 2.4s
#8 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#8 DONE 0.4s
#6 [1/3] FROM docker.io/library/alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1
#6 sha256:9824c27679d3b27c5e1cb00a73adb6f4f8d556994111c12db3c5d61a0c843df8 3.80MB / 3.80MB 0.1s done
#6 DONE 0.2s
#8 [2/3] ADD --link https://gitlab.com/flightgear/openscenegraph.git?branch=release/2024-build /dev/null
#8 extracting sha256:9824c27679d3b27c5e1cb00a73adb6f4f8d556994111c12db3c5d61a0c843df8 0.1s done
#8 merging
#8 merging 0.4s done
#8 DONE 0.8s
#9 [3/3] RUN echo hello
#9 0.046 hello
#9 DONE 0.1s
#10 resolving provenance for metadata file
#10 DONE 0.0s
```
I also could not repro with your full Dockerfile: https://github.com/JLP04/docker-elevation-generator/blob/e78c32668f58752534de7b32ac09b6ece3e62889/Dockerfile
I'm still getting the error somehow: https://github.com/JLP04/docker-elevation-generator/actions/runs/18230061186/job/51911064579
The only other thing I could think of trying would be using the master tag instead of the v6 tag for docker/bake-action in the workflow. JLP04 commented on Oct 6, 2025
Wonder if this is something flaky with GitLab.
On the one hand, I'd love to just conclude that GitLab is being flaky, but on the other hand, I've tried re-running it a bunch of times, so I doubt it's just GitLab being flaky. JLP04 commented on Oct 6, 2025 I was looking back at some of the logs. Could it be a caching issue, since all the different architectures are trying to cache the added repo? Because there were a few errors in the original extended workflow logs (in the zip attached to the original message on this ticket), where it eventually said failed to load cache key. I assume it's saying that because I think by that point git already errored out, but I'm not sure. JLP04 commented on Nov 11, 2025 @crazy-max could this be an issue with the fact that BUILDX_BAKE_GIT_AUTH_TOKEN is automatically set by default? crazy-max commented on Nov 11, 2025 JLP04 commented on Nov 20, 2025 crazy-max commented on May 21, 2026 This should be fixed upstream in Buildx v0.32.0 by docker/buildx#3648.
In this workflow, Bake has the GitHub source/auth context while the Dockerfile also has ADD Git URLs for gitlab.com, so the wrong token could be forwarded to the GitLab fetch and fail with:
fatal: could not read Username for 'https://gitlab.com/': terminal prompts disabled
docker/setup-buildx-action@v3 without a pinned version should now install a Buildx release that includes the fix. If Buildx is pinned, please use v0.32.0 or newer.
Closing this as fixed upstream. If this still reproduces with docker buildx version showing v0.32.0 or newer, please comment with a fresh run link and the Buildx version from the logs. JLP04 commented on May 24, 2026 It seems to be working on the Intel-based runners (which are pulling in buildx version v0.34.0), but for some reason the ARM-based runners are still pulling in buildx version v0.31.1. I've confirmed that it's not a result of GitHub actions caching anything, so I'm not exactly sure what's causing the ARM-based runners to use the old version (see this run for an example).
EDIT: Realized this is due to the runners somehow using the version of buildx that's built into the runner image. Hopefully they'll be synced up by mid-June when GitHub finishes assuming full control of the ARM images. JLP04 commented on Jun 4, 2026 Can confirm this works and is fixed across all runners now. Thanks for the fix!
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|