是否可以使用 Cake 脚本克隆 git 存储库?如果是这样,如何做到这一点?
问问题
1544 次
1 回答
6
使用Cake.Git Addin可以执行大量的 git 操作。通常,您可以在此处找到有关如何使用此插件提供的别名的示例,但是,这些示例尚不存在。
在此期间,以下显示了如何使用四个 GitClone 别名中的每一个的示例。
注意:出于此答案的目的,我们将使用GitHub 上的Cake Git 存储库
GitClone(string, DirectoryPath) </h3>
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/cake-build/cake.git", "c:/temp/cake");
});
RunTarget("Git-Clone");
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/cake-build/cake.git", "c:/temp/cake");
});
RunTarget("Git-Clone");
GitClone(string, DirectoryPath, GitCloneSettings)</a>
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/cake-build/cake.git", "c:/temp/cake",
new GitCloneSettings{ BranchName = "main" });
});
RunTarget("Git-Clone");
GitClone(string, DirectoryPath, string, string)</a>
注意:此别名似乎不会创建输出目录。因此,使用EnsureDirectoryExists别名来确保它存在。
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
EnsureDirectoryExists("c:/temp/cake");
GitClone("https://github.com/cake-build/cake.git",
"c:/temp/cake",
"username",
"password");
});
RunTarget("Git-Clone");
GitClone(string, DirectoryPath, string, string, GitCloneSettings)</a>
注意:此别名似乎不会创建输出目录。因此,使用EnsureDirectoryExists别名来确保它存在。
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
EnsureDirectoryExists("c:/temp/cake");
GitClone("https://github.com/cake-build/cake.git",
"c:/temp/cake",
"username",
"password",
new GitCloneSettings{ BranchName = "main" });
});
RunTarget("Git-Clone");
于 2016-12-08T20:13:40.537 回答