libgit2 / libgit2/libgit2sharp

Cannot push:failed to write chunk header

Open
#1,528 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
3.5k
Forks
925
PR merge metrics
No merged PRs in 30d

Description

I used 0.25.0-preview-0073 with Core

`using (var repo = new Repository(RepositoryPath))
{
// Stage the file
Commands.Stage(repo, "*");

// Create the committer's signature and commit
Signature author = new Signature("translator", "example.com", DateTime.Now);
Signature committer = author;

// Commit to the repository
Commit commit = repo.Commit($"Resx files updated {DateTime.Now}", author, committer);

Remote remote = repo.Network.Remotes["origin"];
var options = new PushOptions
{
    CredentialsProvider = (_url, _user, _cred) =>
       new UsernamePasswordCredentials
       {
           Username = _settings.GitUserName,
           Password = _settings.GitPassword
       }
 };
 repo.Network.Push(remote, @"refs/heads/master", options);

} `

And I get error when I try to push a large file ( > 1GB)

LibGit2Sharp.LibGit2SharpException: failed to write chunk header: The connection with the server was terminated abnormally

at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 136
at LibGit2Sharp.Core.Proxy.git_remote_push(RemoteHandle remote, IEnumerable1 refSpecs, GitPushOptions opts) in C:\projects\libgit2sharp\LibGit2Sharp\Core\Proxy.cs:line 2225 at LibGit2Sharp.Network.Push(Remote remote, IEnumerable1 pushRefSpecs, PushOptions pushOptions) in C:\projects\libgit2sharp\LibGit2Sharp\Network.cs:line 372
at VA.Services.BitbucketService.d__4.MoveNext() in D:\Sources\VA\migrationTool\VA.Services\BitbucketService.cs:line 88

With small file works fine

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the push with a file larger than 1 GB and compare it with the small-file case using the shown LibGit2Sharp code. Start at LibGit2Sharp/Network.cs:372 and Core/Proxy.cs:2225, then follow the error through Core/Ensure.cs:136. Done means the large push no longer terminates abnormally, or the limitation and required conditions are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.