首页 \ 问答 \ LibGit2Sharp 1冲突阻止结帐(LibGit2Sharp 1 conflict prevent from checkout)

LibGit2Sharp 1冲突阻止结帐(LibGit2Sharp 1 conflict prevent from checkout)

我目前有这个问题,我的应用程序使用libgit2sharp总是崩溃witht消息:

1冲突阻止结帐

当试图调用repo.Pull

奇怪的是,如果我打印本地存储库的状态,它们在存储库中没有任何更改。

我甚至尝试重置存储库,或者检查文件,但没有任何帮助。 这是我的代码:

using (LibGit2Sharp.Repository repo = new LibGit2Sharp.Repository(path))
{
    var tipId = repo.Head.Tip.Tree;
    Log.LogManagerInstance.Instance.Info("HEAD tree id: " + tipId.Id.ToString());

    // Pull changes
    PullOptions options = new PullOptions();

    options.FetchOptions = new FetchOptions();
    options.MergeOptions = new MergeOptions();

    // ! Only for trying to fix the bug. Should not be here
    options.MergeOptions.FileConflictStrategy = CheckoutFileConflictStrategy.Theirs;

    repo.Reset(repo.Head.Tip);
    // ! --

    options.FetchOptions.CredentialsProvider = CredentialsHandler;

    Log.LogManagerInstance.Instance.Info("Try pull from remote repository");

    // Pull changes from network
    var result = repo.Network.Pull(new LibGit2Sharp.Signature(username, mail, new DateTimeOffset(DateTime.Now)), options);

    if (result != null && result.Commit != null)
    {
        Log.LogManagerInstance.Instance.Info("Pulled from remote branch, new tree id: " + result.Commit.Tree.Id.ToString());

        // get difference in the git tree (file-system)
        var diffs = repo.Diff.Compare<TreeChanges>(tipId, result.Commit.Tree);

        MergeTreeChangesToDatabase(diffs, path);
    }
    else
    {
        Log.LogManagerInstance.Instance.Info("Local repository is up-to-date with the remote branch");
    }
}

非常感谢你。

编辑

使用预发布0.22似乎解决了我的问题。


I currently have the problem, that my application using libgit2sharp always crashs witht the message:

1 conflict prevents from checkout

when trying to call repo.Pull

The curious thing is, if i print the status of the local repository, their are no changes in the repository.

I even tried resetting the repository at first, or checking the files out, but nothing helps. This is my code:

using (LibGit2Sharp.Repository repo = new LibGit2Sharp.Repository(path))
{
    var tipId = repo.Head.Tip.Tree;
    Log.LogManagerInstance.Instance.Info("HEAD tree id: " + tipId.Id.ToString());

    // Pull changes
    PullOptions options = new PullOptions();

    options.FetchOptions = new FetchOptions();
    options.MergeOptions = new MergeOptions();

    // ! Only for trying to fix the bug. Should not be here
    options.MergeOptions.FileConflictStrategy = CheckoutFileConflictStrategy.Theirs;

    repo.Reset(repo.Head.Tip);
    // ! --

    options.FetchOptions.CredentialsProvider = CredentialsHandler;

    Log.LogManagerInstance.Instance.Info("Try pull from remote repository");

    // Pull changes from network
    var result = repo.Network.Pull(new LibGit2Sharp.Signature(username, mail, new DateTimeOffset(DateTime.Now)), options);

    if (result != null && result.Commit != null)
    {
        Log.LogManagerInstance.Instance.Info("Pulled from remote branch, new tree id: " + result.Commit.Tree.Id.ToString());

        // get difference in the git tree (file-system)
        var diffs = repo.Diff.Compare<TreeChanges>(tipId, result.Commit.Tree);

        MergeTreeChangesToDatabase(diffs, path);
    }
    else
    {
        Log.LogManagerInstance.Instance.Info("Local repository is up-to-date with the remote branch");
    }
}

Thank you very much.

EDIT

Using the pre release 0.22 seems to solve my problem.


原文:https://stackoverflow.com/questions/33545850
更新时间:2022-04-29 16:04

最满意答案

正如评论中所讨论的那样。 此目录配置看起来像一个示例中的普通副本,您的Web根目录可能位于其他位置。

<VirtualHost *:80>
    <directory "/var/www/htdocs">
        AllowOverride None Options
        +ExecCGI -MultiViews 
        +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all 
        AddHandler cgi-script .py
        Require all granted
    </directory>
</VirtualHost>

例如,目录更改的位置。 这通常是默认路径,如果您的/var/www/html更改。

我之前已经知道了这个问题,但是这个问题在服务器故障上也可能会更好,因为这与apache的配置方式有很大关系。


As discussed in the comments. This directory configuration looks like a plain copy from an example, and your Web root is probably somewhere else.

<VirtualHost *:80>
    <directory "/var/www/htdocs">
        AllowOverride None Options
        +ExecCGI -MultiViews 
        +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all 
        AddHandler cgi-script .py
        Require all granted
    </directory>
</VirtualHost>

For instance where directory is changed. That's the default path usually, if yours is /var/www/html change accordingly.

I've gotten shit for this earlier but this question might also be better off on serverfault considering this is strictly related to how apache should be configured.

相关问答

更多
  • 你的Python程序的名称是什么? 是/usr/lib/cgi-bin/file.cgi吗? 这个文件的权利是什么? 可以通过apache读取吗? 可以执行吗? 第一行是#!/usr/bin/env python还是类似的好? 确保可以从命令行运行此文件(即shebang是好的) apache是否收到该文件的请求? 查看apache日志,尤其是error.log和access.log (可能在/var/log/apache ) 确保在Apache配置中为/usr/lib/cgi-bin/目录启用了ExecC ...
  • 您的表单操作是“filename.pl”。 这意味着Web服务器将在包含表单的HTML页面所在的目录中查找“filename.pl”。 这不是它的地方。 你可能想要完整的路径。
    Your form action is "filename.pl". That means the web server will look for "filename.pl" in the same directory as the HTML page c ...
  • 万岁担心安全! 是。 总是有安全漏洞。 使用HTTPS而不是HTTP ... Everywhere ...(从letsencrypt.com获得免费证书) 提交数据通常应该使用POST,而不是GET。 (POST和HTTPS意味着数据在传输过程中被加密。通过本身未加密的URL来请求数据。 移动与桌面不是问题 Json与什么都不是问题 Django与Python CGI并不是真正的问题:如果配置不当,可能会有安全问题。 Hooray for worrying about security! Yes. Ther ...
  • 我现在在.htaccess中使用带有以下命令的重写引擎: RewriteEngine On RewriteCond %{REQUEST_URI} !^(/index.py|/downloads) RewriteRule ^(.*)$ /index.py?url=$1 I now use a rewrite engine with the following commands in the .htaccess: RewriteEngine On RewriteCond %{REQUEST_URI} !^(/ ...
  • apach2 2.4.6不要将/ etc / apache2 / mods-enabled中的cgid.conf和cgid.load作为默认值。 在从mods-available到mods-enabled进行软链接之后,问题就解决了。 apach2 2.4.6 don't put cgid.conf and cgid.load in /etc/apache2/mods-enabled as default. after make soft link from mods-available to mods-e ...
  • 如果删除了ScriptAlias指令,则应该ScriptAlias添加到目录的主配置或.htaccess文件中: Options +ExecCGI AddHandler cgi-script py If you removed the ScriptAlias directive, you should probably add the following lines into the main config for the directory or into .htaccess file: Options ...
  • 正如评论中所讨论的那样。 此目录配置看起来像一个示例中的普通副本,您的Web根目录可能位于其他位置。 AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all ...
  • 在理论上运行带有httpd的python脚本你需要检查它是否存在: in httpd.conf : Include conf.modules.d/*.conf LoadModule wsgi_module modules/mod_wsgi.so IncludeOptional conf.d/*.conf # -------------------- End of file 然后你可以尝试在/etc/httpd/conf.d/中创建youvirtualhost.conf并添加如下内容:
  • 终于解决了。 我没有注意到我在80端口上运行Lighttpd,Apache也在监听端口。 通过将Apache设置为侦听端口8080,它可以完美地工作。 尽管如此,我要感谢所有为解决我的问题做出贡献的人。 Finally solved it. I haven't noticed that I ran Lighttpd on port 80 and Apache also listens to that port. By setting the Apache to listen to port 8080 it ...
  • 当您遇到500个错误时,一个提示是在命令行上运行脚本,这通常会告诉您拼写错误或其他解释程序级别的问题。 查看日志也可以报告相同的错误,但通常更容易通过直接运行脚本来查看正在发生的情况。 具体来说,至少有一个问题是这一行中的拼写错误: #/usr/bin/env python 应该是: #!/usr/bin/env python 线索是,当你想要通过环境的python解释器运行时,按原样运行脚本会显示通过bash解释器显示的错误。 When you run into 500 errors, one tip ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)