Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting "not a git repository" when tying to run "az acr build"

I've been studying Azure Container Registry and I'm using Microsoft's documentation. Right now I'm trying to follow theses steps: https://learn.microsoft.com/en-us/training/modules/publish-container-image-to-azure-container-registry/6-build-run-image-azure-container-registry

But when I try to run my command: az acr build --image sample/hello-world:v1 --verbose --registry az204acrcarol --resource-group az204-acr-rg --verbose . I keep getting:

Output from dependency scanning: fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I am absolutely sure that I am in a git repository, which is https://github.com/aclimarin/az204. When I run git status in the same directory I get:

On branch main \ Your branch is up to date with 'origin/main'.


See the print below:

enter image description here


This is the content of my Dockerfile:

FROM mcr.microsoft.com/hello-world

I already tried to specify the repository URL with the command:

az acr build --image sample/hello-world:v1 --registry az204acrcarol --resource-group az204-acr-rg --file Dockerfile --build-arg BUILD_CONTEXT=https://github.com/aclimarin/az204.git .

I also tried to add --no-push flag

like image 607
Ana Carol Avatar asked Oct 20 '25 00:10

Ana Carol


1 Answers

For anyone else facing this problem, I have found a solution.

In my case, the Dockerfile created with the Powershell command echo “FROM mcr.microsoft.com/hello-world” > Dockerfile had a UTF-16 LE encoding.

I opened vscode and changed it to UTF-8 and the error was gone.

like image 185
Lukas Brinkmann Avatar answered Oct 22 '25 13:10

Lukas Brinkmann



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!