首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在蛋糕脚本中成功执行GitPush或GetPushRef

无法在蛋糕脚本中成功执行GitPush或GetPushRef
EN

Stack Overflow用户
提问于 2019-08-22 15:48:35
回答 1查看 272关注 0票数 1

我试图使用GitAliases从Jenkins上的蛋糕脚本中对Git进行一些修改。我克服了文档(https://cakebuild.net/api/Cake.Git/GitAliases/)中GitAdd()、GitCommit()和GitTag()中的方法和参数缺乏描述性信息和示例的问题,这些方法和参数现在都很成功,但无论我尝试什么,都无法使GitPush()或GitPushRef()工作起来。

代码语言:javascript
复制
#addin "nuget:https://www.nuget.org/api/v2?package=Cake.Git";

using System;
using System.IO;

var gitUserName = Argument("gitUserName","userName");
var gitUserPassword = Argument("gitUserPassword","");
var gitEmail = Argument("gitEmail","some.user@domain.com");
var gitBranchName = Argument("gitBranchName","feature/test-git");


Task("Git:CommitAndPush")
    .Does(() =>
    {
        var rootPath = "./..";
        Information($"Commit and Push {rootPath}");

        Information("Staging all updated files in /available, /extracted, and /src directories...");
        var toAdd = new FilePath[]
        {
            new FilePath(Path.Combine(rootPath, "available")),
            new FilePath(Path.Combine(rootPath, "extracted"))
        };
        GitAdd(rootPath, toAdd);

        Information("Committing files...");
        var commit = GitCommit(rootPath, gitUserName, gitEmail, "Commit message");

        Information($"Pushing changes for commit {commit}...");

        // TODO: Cannot get any of these to work!
        //GitPush(rootPath);
        //GitPush(rootPath, gitUserName, gitUserPassword);
        //GitPush(rootPath, gitUserName, gitUserPassword, gitBranchName);

        //var gitTag = "myTag";
        //GitTag(rootPath, gitTag);
        //GitPushRef(rootPath, "origin", gitTag);
        //GitPushRef(rootPath, gitUserName, gitUserPassword, "origin", gitTag);

        Information("Git process complete!");
    });

我尝试过GitPush()和GitPushRef()的每一次重载,包括创建一个标记和使用GitPushRef()推送标记,但没有成功。我可以看到提交在本地成功,标记被创建,但是Push总是失败。我遇到的最常见的错误是:

错误:出现一个或多个错误。不支持的URL协议

Git用户帐户使用SSH。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-08-22 16:18:24

蛋糕Git使用libgit2sharp进行git操作,它不支持SSH。

在libgit2sharp GitHub回购https://github.com/libgit2/libgit2sharp/issues/1422上有一个公开的问题

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57613043

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档