git describe within docker

Hallo TeamCity community!

We are generating an header file containing git version information using "git describe" within a docker container build. The problem is that the command doesn't work within the container since we bind the current project inside the container:

error: object directory /mnt/sdb/buildAgent/system/git/git-9CFEF13C.git/objects does not exist; check .git/objects/info/alternates.
fatal: HEAD is not a valid 'commit' object

Indeed, there is a weird git configuration (lfs?!):

$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
sparseCheckout = true
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[lfs]
storage = /mnt/sdb/buildAgent/system/git/git-9CFEF13C.git/lfs

We are using TeamCity2019.2.3 (build 72031). Is there a way to get around this?

1
2 comments

I'm getting the same bug.
In my case I'm doing some operation in container runtime

0

I think I found where it need to be changed https://www.jetbrains.com/help/teamcity/2022.04/git.html#GitAgentSettings
See Checkout policy: Do not use mirrors

0

Please sign in to leave a comment.