可以使用Cake.Git Addin执行大量的git操作.通常,您可以在此处找到有关如何使用此插件提供的别名的示例,但是,这些示例尚不存在.
在此期间,下面显示了如何使用四个GitClone别名中的每一个的示例.
注意:出于本答案的目的,我们将使用GitHub上的Cake Git存储库
#addin nuget:?package=Cake.Git
Task("Git-Clone")
.Does(() =>
{
GitClone("https://github.com/cake-build/cake.git", "c:/temp/cake");
});
RunTarget("Git-Clone");
Run Code Online (Sandbox Code Playgroud)
#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");
Run Code Online (Sandbox Code Playgroud)
注意:此别名似乎不会创建输出目录.因此,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");
Run Code Online (Sandbox Code Playgroud)
注意:此别名似乎不会创建输出目录.因此,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");
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1038 次 |
| 最近记录: |