Git克隆问题在蛋糕里 [英] Git clone issue in cake
本文介绍了Git克隆问题在蛋糕里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用下面的链接克隆源代码
http://cakebuild.net/api/Cake.Git/GitAliases/2ACDDC0F
GitClone (https://github.com/cake-build/cake.git,
c:/ temp / cake,
用户名,
密码,
new GitCloneSettings {BranchName =development});
它用于克隆分支源。
当我使用标签名称(标签/ 12.4.2.1)而不是branchName时,面临以下问题
引用'refs / remotes / origin / tags / 12.4.2.1'找不到
$ b 注意:标记/ 12.4.2.1存在
<作为一个起点,目前只找到解决方法,
执行
/ 1265203rel =nofollow noreferrer> git clone specific tag commands through cmd
StartProcess
StartProcess
任务(默认)
.Does((()=> ;
{
GitClone(https://github.com/cake-build/cake.git,
d:/ temp / cake,
userName ,
密码,
新的GitCloneSett ings {BranchName =main});
Cmd(cd / DD:\\temp\\\\\\\\,
& 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)
args.Append(${param});
StartProcess(cmd,new ProcessSettings {Arguments = args});
}
}
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
解决方案
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 });
}
}
这篇关于Git克隆问题在蛋糕里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文