Gig2go:在远程服务器上解压发送的打包文件失败。

huangapple go评论73阅读模式
英文:

Gig2go: unpacking the sent packfile failed on the remote

问题

我一直在努力解决这个问题。我正在尝试使用下面的代码将更改推送到仓库:

// 获取远程仓库
remote, err := repo.Remotes.Lookup("origin")
if err != nil {
remote, err = repo.Remotes.Create("origin", repo.Path())
if err != nil {
return err
}
}

// 获取分支
branch, err := repo.Branch()
if err != nil {
return err
}

// 获取分支名称
branchName, err := branch.Name()
if err != nil {
return err
}

if err := remote.Push([]string{"refs/heads/" + branchName}, &git.PushOptions{}); err != nil {
return err
}

一切看起来都很好,但我一直收到以下错误:

在远程仓库上解压发送的包文件失败

阅读了一些 Git 资源后,我现在明白了这个错误的含义,但我仍然不知道是什么原因导致它。

编辑:

我刚刚尝试了 @Carlos 的建议,使用 Git,现在我获得了更多的信息:

git push --set-upstream origin master
计数对象:3,完成。
使用最多 4 个线程进行增量压缩。
正在压缩对象:100%(2/2),完成。
正在写入对象:100%(3/3),241 字节 | 0 字节/秒,完成。
总共 3 个(增量 0),重用 0 个(增量 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'

我认为我已经正确设置了权限,这是服务器上 Git 目录的样子:

root@CodeSpaces-001:/home/git# ll
总计 40
drwxr-xr-x 5 git git 4096 7月 29 19:22 ./
drwxr-xr-x 3 root root 4096 7月 29 18:21 ../
drwxrwxr-x 3 git git 4096 7月 29 19:22 apps/ # 我的仓库在这里

这不应该足够吗?

英文:

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?

答案1

得分: 1

这是一个在服务器上发生的错误,所以需要查看服务器的日志。你尝试过使用git本身进行相同的操作吗?我记不清了,但可能有一个额外的错误字符串,目前libgit2没有返回。

在服务器上解压缩时出现的错误通常与git在远程上运行的用户的权限有关。

英文:

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.

答案2

得分: -1

我在VSTS同步期间遇到了同样的问题,并在VSTS输出窗口中看到了相同的错误消息。

我的解决方法是访问https://app.vssps.visualstudio.com/_signedin,然后很可能将我的凭据登录到远程服务器上。

之后,返回VSTS并再次进行同步,错误就会消失。希望对你有帮助。

英文:

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.

huangapple
  • 本文由 发表于 2015年7月30日 01:33:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/31707337.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定