"error from receiver: failed to rename .git\objects..." when outputting an existing file in git on Windows
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 10.3k
- Forks
- 1.5k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 48
Description
Apologies if this is the wrong place but I believe the issue lies with the output mode of buildkit on Windows when inside a git folder. I have made a simple Dockerfile that demonstrates the issue.
FROM alpine:3.13 AS base
WORKDIR /src
COPY . .
RUN echo "bla" >> /src/bla
FROM scratch AS end
COPY --from=base /src/ /
When I run docker build . --output=. the first time it runs with no issues, creating a file called bla.
However if I run git init, then git add Dockerfile and try building again, I get the following error:
#10 exporting to client
#10 sha256:b60a1292d407630dbb741f28ab6ea4ce3cca872ac28eeee56f4e66a182eca4bc
#10 copying files 11.64kB 0.1s
#10 copying files 25.41kB 0.2s done
#10 ERROR: error from receiver: failed to rename .git\objects\6d\.tmp.943549809 to .git\objects\6d\3ed2f8a87e63b5c06c7a08c2ab46b7b044c0e9: rename .git\objects\6d\.tmp.943549809 .git\objects\6d\3ed2f8a87e63b5c06c7a08c2ab46b7b044c0e9: Access is denied.
------
> exporting to client:
------
error from receiver: failed to rename .git\objects\6d\.tmp.943549809 to .git\objects\6d\3ed2f8a87e63b5c06c7a08c2ab46b7b044c0e9: rename .git\objects\6d\.tmp.943549809 .git\objects\6d\3ed2f8a87e63b5c06c7a08c2ab46b7b044c0e9: Access is denied.
This does not happen on other platforms, nor does it happen if the directory is not initialised for git or if git is initialised but no files have been added.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the supplied Dockerfile with docker build . --output=. on Windows, comparing an ordinary directory with a Git-initialized directory after git add Dockerfile. Trace BuildKit's output/export receiver handling for the reported .git\objects rename; done means the second build succeeds without changing behavior on other platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, git, go
- Domain
- build-system, devops, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100