A large number of git operations can be performed using Cake.Git Addin . You can usually find examples of how to use the aliases provided by this addin here , however these examples do not yet exist.
In the interim, below are examples of how each of the four GitClone aliases can be used.
NOTE. . For the purpose of this answer, we will use the Cake git repository on GitHub
#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", new GitCloneSettings{ BranchName = "main" }); }); RunTarget("Git-Clone");
NOTE. This alias does not seem to create an output directory. As a result, EnsureDirectoryExists are used to verify that it exists.
#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");
NOTE. This alias does not seem to create an output directory. As a result, EnsureDirectoryExists are used to verify that it exists.
#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");
source share