libgit2 / libgit2/libgit2sharp

Push fails with "No error message has been provided by the native library" when trying to push large files

Open
#2,012 1 comment 0 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 am not able to push large files to origin with pre-release 0.27.0-preview-0182. The same code worked with latest stable release
Ending up with exception and message: "No error message has been provided by the native library"
Tried to push a new json file which is 18MB large.
I did not check what file size is the breaking point, but if needed can try to investigate that too.

Adding reproduction steps with snippets of my code, hope this is enough, otherwise please ask for more.

Reproduction steps
  1. Clone repository and create branch
Repository.Clone(githubRepoUrl, $"./{folderName}", 
  new CloneOptions { CredentialsProvider = _gitHubClientWrapper.CredentialsProvider() });

using (var repo = new Repository($"./{folderName}"))
{
  repo.CreateBranch(newBranchName);
}
  1. Create large file. I just generated a large list of objects serialized into json. Got around 18mb of json file.
  2. Commit and push the branch to origin
using (var repo = new Repository($"./{folderName}"))
{
	Branch branch = repo.Branches[newBranchName];
	Commands.Checkout(repo, branch);
	Commands.Stage(repo, "*");
	Signature committer = new Signature("Github bot", "@bot", DateTime.Now);

	try
	{
		repo.Commit("Comit message", committer, committer);
		Remote remote = repo.Network.Remotes["origin"];
		repo.Branches.Update(branch, b => b.Remote = remote.Name, b => b.UpstreamBranch = branch.CanonicalName);
		repo.Network.Push(branch, new PushOptions
		{
			CredentialsProvider = _gitHubClientWrapper.CredentialsProvider(),
		});

	}
	catch (EmptyCommitException)
	{
		_logger.LogInformation("There's nothing to commit.");
		return;
	}
}
Expected behavior

Push is successful.

Actual behavior

Push fails with exception and message "No error message has been provided by the native library"

Version of LibGit2Sharp (release number or SHA1)

0.27.0-preview-0182

Operating system(s) tested; .NET runtime tested

Windows11, .NET 7

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 failure by cloning, creating an approximately 18 MB JSON file, committing it, and calling repo.Network.Push with the shown PushOptions on 0.27.0-preview-0182; compare the same steps with the latest stable release. Trace the Repository and repo.Network.Push entry points and determine whether the regression is in push handling or native error reporting; done means the large-file push succeeds or reports a useful, actionable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, git
Domain
devtools
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.