【问题标题】:Repository not being cloned inside a docker container using LibGit2Sharp没有使用 LibGit2Sharp 将存储库克隆到 docker 容器中
【发布时间】:2019-11-06 23:32:57
【问题描述】:

我目前正在使用 .net 标准 2.0 部署一个微服务,它可以克隆或更新来自 GitLab 的存储库。

为此,我有一个可以在 Windows 环境中完美运行的功能,但在我启动它后它在 docker 容器内无法发挥作用。

if (gitFolder.GetDirectories().Length == 0)
{
    try
    {
        // Get user credentials
        Repository.Clone("repository.git", deployerPath, new CloneOptions()
        {
            BranchName = "develop",
            CredentialsProvider = CredentialsProvider(),
        });
    }
    catch (Exception ex)
    {
        ...
    }
}
else
{
    try
    {
        var repository = new Repository(deployerPath);
        Commands.Pull(repository,
            new Signature("blah", "blah@blah.com", DateTimeOffset.Now), new PullOptions()
            {
                FetchOptions = new FetchOptions() {CredentialsProvider = CredentialsProvider()},
                MergeOptions = new MergeOptions() {FailOnConflict = true},
            });
    }
    ...

我希望看到包含所有子文件夹/文件的文件夹,就像在 Windows 中一样,但它始终是空的。此外,文件夹的时间戳会在它应该进行拉取时更新。

这是 Linux 发行版的信息:

Linux 828ec2e85f2c 4.9.184-linuxkit #1 SMP 2019 年 7 月 2 日星期二 22:58:16 UTC x86_64 GNU/Linux

我看到了其他问题,他们指出在拉动时应该进行一些初始化设置,但至少应该进行克隆(根据我的阅读内容)。

非常感谢任何帮助。

【问题讨论】:

    标签: c# docker .net-standard-2.0 libgit2sharp


    【解决方案1】:

    添加一些日志记录后,我发现这是错误消息:重定向或身份验证重放次数过多。所以我继续并应用了for this question 所述的解决方案来使其工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-10
      • 2019-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多