Docker build git failure

Hi:
Using the latest Docker build process and current vyos-1x repo (as of today), I run into a problem with git. The log shows the error:

Could not retrieve information from git: SHA could not be resolved, git returned: b’’
Could not build a version string specific to git branch, falling back to default: git branch could not be determined

If I try git status on the command line before the build, git complains with:

vyos_bld@2716ef9564d0:/vyos$ git status
warning: unable to access ‘/etc/gitconfig’: Is a directory
warning: unable to access ‘/etc/gitconfig’: Is a directory
warning: unable to access ‘/etc/gitconfig’: Is a directory
fatal: unknown error occurred while reading the configuration files

I can’t seem to delete the ‘/etc/gitconfig’ directory to make it a file.

Any siggestions?
Thanks

How did you clone the repository?

Please share all steps

Hi:
I was following the guide at: Build VyOS — VyOS 1.4.x (sagitta) documentation
The clone step is:
git clone -b current --single-branch https://github.com/vyos/vyos-build

dcs@debian:~$ docker images
REPOSITORY        TAG       IMAGE ID       CREATED       SIZE
vyos/vyos-build   current   7ae8d888bfe2   3 weeks ago   3.42GB

And I used this alias to start the container:

alias vybld='docker pull vyos/vyos-build:current && docker run --rm -it \
    -v "$(pwd)":/vyos \
    -v "$HOME/.gitconfig":/etc/gitconfig \
    -v "$HOME/.bash_aliases":/home/vyos_bld/.bash_aliases \
    -v "$HOME/.bashrc":/home/vyos_bld/.bashrc \
    -w /vyos --privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 \
    -e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) \
    vyos/vyos-build:current bash'

Maybe the volume map here is the problem?

I beleive I figured this out. I deleted the directory named .gitconfig in my user directory and after, when I run the vybld alias command I can use the git commands normally.
The voume mapping was my issue.
Thanks for listening.

I tried the build procedure on a new CentOS installation and this happened again.
When I started there was no .gitconfig item in the home directory. It appeared after I ran the build container with:

docker pull vyos/vyos-build:current && docker run --rm -it \
    -v "$(pwd)":/vyos \
    -v "$HOME/.gitconfig":/etc/gitconfig \
    -v "$HOME/.bash_aliases":/home/vyos_bld/.bash_aliases \
    -v "$HOME/.bashrc":/home/vyos_bld/.bashrc \
    -w /vyos --privileged --sysctl net.ipv6.conf.lo.disable_ipv6=0 \
    -e GOSU_UID=$(id -u) -e GOSU_GID=$(id -g) \
    vyos/vyos-build:current bash

It seems if no .gitconfig item is present then the -v option creates a .gitconfig directory to mount.
If I exit and delete the .gticonfig directory and touch a .gitconfig file, git works fine in the container.

Same thing with Debian GNU/Linux 11 (fresh install).
Linux vyosbuilder 5.10.0-10-amd64 #1 SMP Debian 5.10.84-1 (2021-12-08) x86_64 GNU/Linux

I also had do delete the directory ~/.gitconfig