dpb56083
dpb56083
2015-07-29 17:33

Gig2go:在远程上解压缩已发送的打包文件失败

已采纳

I've struggled so much with this. I'm trying to push changes to the repo using the code below:

// 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
}

Everything seems fine, but I keep getting this error:

unpacking the sent packfile failed on the remote

Upon reading a few git resources, I now understand what the error means, but I still have no idea what is causing it.


Edit

I have just tried using Git as per @Carlos' suggestion, and I'm am getting more information now:

git push --set-upstream origin master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 241 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: error: insufficient permission for adding an object to repository database ./objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
To http://xxxxxxx/xxxxxx/app.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to 'http://xxxxxxx/xxxxxxx/app.git'

I thought I got the permissions right though, here is how my Git directory looks like on the server:

root@CodeSpaces-001:/home/git# ll
total 40
drwxr-xr-x 5 git  git  4096 Jul 29 19:22 ./
drwxr-xr-x 3 root root 4096 Jul 29 18:21 ../
drwxrwxr-x 3 git  git  4096 Jul 29 19:22 apps/ # My repos are in here

Should this not be sufficient?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • dongye9071 dongye9071 6年前

    This is an error, which happens on the server, so the place to look would be its logs. Have you tried doing the same operation with git itself? I don't remember off-hand, but there might be an extra error string which libgit2 is not returning at the moment.

    Errors to unpack on the server are often related to the permissions of the user which git is running on the remote.

    点赞 评论 复制链接分享
  • dousuohe5882 dousuohe5882 4年前

    I had the same problem during VSTS Sync, and saw in VSTS output window with the same error message.

    My fix is to go to https://app.vssps.visualstudio.com/_signedin and then most likely get my cred logged onto the remote server.

    Afterwards, come back to VSTS and Sync again, the error is gone. HIH.

    点赞 评论 复制链接分享

相关推荐