克隆用于构建的存储库时,如何让 TeamCity 创建 .git 目录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17555931/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I get TeamCity to create the .git directory when cloning a repo for build?
提问by xofz
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.
我正在尝试在我的 MSBuild 文件中运行自定义命令;它基本上运行“git log -10”并将提交信息存储到文本文件中。
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!
问题是,当我尝试运行构建时,它错误地说“致命:不是 git 存储库”。所以我检查了我的项目的 TeamCity 的工作目录,并没有 .git 目录!
Why doesn't TeamCity create the .git directory when it clones the repository? Is there a way to enable this?
为什么 TeamCity 在克隆存储库时不创建 .git 目录?有没有办法启用它?
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.
编辑:TeamCity 版本为 7.1.2;我会尝试更新到 8.0.1,看看是否有可用的选项。
回答by xofz
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.
我将 VCS 结帐模式从服务器更改为“自动在代理上”,现在可以使用了!感谢这个问题的答案:在 TeamCity 构建步骤中使用 git 命令。
回答by qqli
It is documented as VCS Checkout Mode: https://confluence.jetbrains.com/display/TCD9/VCS+Checkout+Mode
它被记录为 VCS Checkout Mode:https: //confluence.jetbrains.com/display/TCD9/VCS+Checkout+Mode
TeamCity version is 9.x
TeamCity 版本是 9.x