How do I get TeamCity to create the .git directory when cloning a repo for build?

13,599

Solution 1

I changed the VCS checkout mode from server to "automatically on agent" and it works now! Thanks to the answer for this question: Using git commands in a TeamCity Build Step.

Solution 2

It is documented as VCS Checkout Mode: https://confluence.jetbrains.com/display/TCD9/VCS+Checkout+Mode

TeamCity version is 9.x

Share:
13,599
xofz
Author by

xofz

This is the engineer behind the x(z) framework for .NET. I can help with questions or concerns for the framework.

Updated on June 27, 2022

Comments

  • xofz
    xofz almost 2 years

    I'm trying to run a custom command in my MSBuild file; it basically runs 'git log -10' and stores that commit info into a text file.

    The problem is, when I try to run the build, it errors saying "fatal: Not a git repository". So I checked TeamCity's work directory for my project, and there is no .git directory!

    Why doesn't TeamCity create the .git directory when it clones the repository? Is there a way to enable this?

    edit: TeamCity version is 7.1.2; I'll try updating to 8.0.1 to see if there is an option available for this.

  • Lee Englestone
    Lee Englestone over 9 years
    Unfortunately it wont let you do this if you have checkout rules :-(
  • Stoffe
    Stoffe over 7 years
    Default changed in 10.x but old settings are retained when upgrading: confluence.jetbrains.com/display/TCD10/VCS+Checkout+Mode