Git clone issue in cake

假如想象 提交于 2019-12-12 06:59:21

问题


Cloning the source using below link

http://cakebuild.net/api/Cake.Git/GitAliases/2ACDDC0F

GitClone("https://github.com/cake-build/cake.git", 
    "c:/temp/cake", 
    "username", 
    "password",
    new GitCloneSettings{ BranchName = "development" });

It works for cloning the branch source.

When i use the tag name(tags/12.4.2.1) instead of branchName facing the below issue

reference 'refs/remotes/origin/tags/12.4.2.1' not found

Note: tags/12.4.2.1 is exist


回答1:


As a starting point, for the moment found only workaround, to execute git clone specific tag commands through cmd StartProcess

    Task("Default")
        .Does(() =>
        {
            GitClone("https://github.com/cake-build/cake.git", 
                "d:/temp/cake", 
                "userName", 
                "password",
                new GitCloneSettings{ BranchName = "main" });

            Cmd("cd /D D:\\temp\\cake",
                " & git checkout v0.8.0",
                " & git branch -D main",
                " & git checkout -b main");
        });

private void Cmd(params object[] parameters)
{
    if (parameters.Any())
    {
        var args =  new ProcessArgumentBuilder()
            .Append(@"/c");

        foreach (var param in parameters)
            args.Append($"{param}");

        StartProcess("cmd", new ProcessSettings { Arguments = args });
    }
}   


来源:https://stackoverflow.com/questions/43977986/git-clone-issue-in-cake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!