我为此苦苦挣扎。我正在尝试使用以下代码将更改推送到 repo:
// Get remote
remote, err := repo.Remotes.Lookup("origin")
if err != nil {
remote, err = repo.Remotes.Create("origin", repo.Path())
if err != nil {
return err
}
}
// Get the branch
branch, err := repo.Branch()
if err != nil {
return err
}
// Get the name
branchName, err := branch.Name()
if err != nil {
return err
}
if err := remote.Push([]string{"refs/heads/"+branchName}, &git.PushOptions{}); err != nil {
return err
}
一切似乎都很好,但我不断收到此错误:
unpacking the sent packfile failed on the remote
在阅读了一些 git 资源后,我现在明白了错误的含义,但我仍然不知道是什么导致了它。
潇湘沐
相关分类