0

大きなリポジトリをリモートにプッシュすると、タイムアウト例外が発生しました。

リモートのタイムアウトを設定するには?

アップデート:

エラーメッセージ

LibGit2Sharp.LibGit2SharpException: An error was raised by libgit2. Category = Invalid (Error).
Failed to receive response: The operation timed out

   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
   at LibGit2Sharp.Core.Proxy.git_push_finish(PushSafeHandle push)
   at LibGit2Sharp.Network.Push(Remote remote, IEnumerable`1 pushRefSpecs, PushOptions pushOptions)
   at LibGit2Sharp.Network.Push(Remote remote, String pushRefSpec, PushOptions pushOptions)
   at ConsoleApplication1.Program.Main(String[] args) in xxxx\Program.cs:line 52

私のコード

using (var repo = new Repository(@"path\to\local"))
{
    try
    {
        var remote = repo.Network.Remotes["VM"]
            ?? repo.Network.Remotes.Add("VM", @"https://path/to/remote");
        repo.Network.Push(remote, @"refs/heads/develop");
    }
    catch (Exception ex)
    {
        var str = ex.ToString();
    }
}

レポサイズ

$ git count-objects -v
count: 0
size: 0
in-pack: 14389
packs: 1
size-pack: 12138
prune-packable: 0
garbage: 0
size-garbage: 0

同時に、ASP.NET MVC ベースの git サーバーで例外が発生しました

System.Web.HttpException (0x80004005) ---> System.Web.HttpException (0x80070057): The remote host closed the connection. The error code is 0x80070057.
4

1 に答える 1

2

そのタイムアウトはWinHttpReceiveResponse();から来ます。MSDN は、このデフォルト値が 30 秒であることを示唆していますが、これは残念ながら低い値です。

現在、トランスポートにタイムアウトを渡す方法はありません。いずれ追加する必要があると思います。

于 2014-02-06T12:46:50.327 に答える