rust-lang / rust-lang/git2-rs

unpacking the sent packfile failed on the remote

Open
#1,162 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.1k
Forks
450
Avg merge
11m
Merged PRs (30d)
1

Description

Getting error while pushing a new branch using library

unpacking the sent packfile failed on the remote; class=Net (12)

but if I go to directory and try to push the branch using Git with command, it works without any issues.

git push <remote> refs/remotes/<remote>/<branch>:refs/heads/<branch>

So I am not able to figure out if I am doing anything wrong in script that I wrote or if there is some issue on server.

Here is sample script

    let ssh_key =
        std::path::PathBuf::from(<SSH private key path>)
    let repo = git2::Repository::open(".")?;
    let mut remote = repo.find_remote(<remote_name>)?;

    let mut push_options = git2::PushOptions::new();
    let mut cbs = git2::RemoteCallbacks::new();
    cbs.credentials(|_url, username, _allowed_type| {
        git2::Cred::ssh_key(username.unwrap(), None, &ssh_key, None)
    });
    push_options.remote_callbacks(cbs);

    remote.push(
        &[&format!(
            "refs/remotes/upstream/<branch>:refs/heads/<branch>",
        )],
        Some(&mut push_options),
    )?;

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

Start with the sample remote.push call and compare its refspec, remote selection, and SSH callback with the working Git command. Reproduce the push and inspect the complete library and server output; done means identifying whether the failure is in the Rust call or the remote server and documenting a confirmed cause.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, rust
Domain
devtools, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.