解包器错误Git-从裸回购推送到登台服务器 [英] Unpacker error Git-pushing from bare repo to staging server

查看:365
本文介绍了解包器错误Git-从裸回购推送到登台服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

涉及 Git pull错误:无法创建临时sha1文件名



大家好。一段时间以来,我们在一个git项目中使用了我们的应用程序,并在另一台服务器上使用裸回购。裸露的repo有一个post-receive钩子,它可以推送到我们的登台服务器,而这个服务器又有一个post-recieve钩子来完成与部署相关的所有工作。这一切都工作正常,但现在裸露的回购无法推送到登台服务器。这与post-receive进程本身没有任何关系,因为如果我使用裸回购并从那里手动推送到登台服务器,我会得到相同的错误:

 计数对象:11,完成。 
使用多达8个线程的增量压缩。
压缩对象:100%(7/7),完成。
写作对象:100%(7/7),1.74 KiB,完成。
合计7(delta 5),重用0(delta 0)
错误:无法创建临时sha1文件名./objects/51:没有这样的文件或目录

致命:未能写入对象
错误:解压缩失败:解包器退出,错误代码为
至ssh://deploy@our-staging-server.com/var/www/apps/e_learning_staging/www
! [远程拒绝]开发 - >开发(不适用(解包器错误))
错误:未能将某些参考推送到'ssh://deploy@our-staging-server.com/var/www/apps/e_learning_staging/www'

我可以进入暂存服务器并从裸仓库中取出,然后推送给它。所以从A拉到B是可行的,但从A推到B不行。



我见过不少有类似问题的人,以下问题:1)不同的用户:推送到部署用户,这是任何人在登台服务器上使用的唯一用户,这不是一个问题。 / p>

2)文件权限:我已递归地在.git中部署所有文件来部署:deploy(我们使用的用户和组),并递归地chmodded u + w,g + w到.git中的所有文件中



<3> git-fsck,git-gc。我已经在回购站和登台服务器上完成了这些操作。



4)新文件许可权:在登台服务器上执行umask给出0022,这相当于到 u = rwx,g = rx,o = rx ,这样应该没问题。 5)设置sharedRepository = true在这个例子中,我将它改为0002,现在让组做任何事情以及用户做任何事情都没有什么不同。

5) .git / config,在登台服务器上。我是这么想的,也许有必要从裸仓库推出它。 6)git-repack:我试过了,我没有任何区别(它从来没有设置过,所以一切正常),所以我把它拿出来了。

一个重新包装,但被告知没有什么可以打包的。



7) c> git reset --hard 服务器。没有帮助。



8)没有用完磁盘空间。



我感觉像我我研究过这一切,并尝试了一切,它正在帮助我。任何人都可以建议我可以尝试的其他事情吗?



编辑 - 我试图将repo克隆到登台服务器上的一个新文件夹中,并将裸露的repo的git config更改为指向 staging_server远程。然后我从本地机器上推到裸露的回购站,然后试图从回购站推送到登台服务器,并得到同样的问题:

 错误:无法创建临时sha1文件名./objects/26:没有这样的文件或目录



暂存服务器上的.git文件夹中没有objects / 26文件夹,但我不知道为什么它不能创建一个。

方案

发现它是什么,感觉就像是一个愚蠢的结果。



最初,在分期框中,git回购是在外面的应用程序文件夹。为了做到这一点,我们在git config中添加了一个选项:

  worktree = / path / to / app /文件夹

在某些时候,我们决定将git repo移动到实际的工作文件夹中,像往常一样.git文件夹。上面的选项仍然在配置中,即使它是正确的文件夹,但它存在的事实是阻止解包器工作。一旦我将这个选项从配置中取出,那么它就会马上工作。 Doh。


Related to Git pull error: unable to create temporary sha1 filename

Hi all. We've had our app in a git project with a bare repo on a different server, for some time now. The bare repo has a post-receive hook which makes it push to our staging server, which in turn has a post-recieve hook to do all the stuff associated with a deploy. It's all been working fine, but now the bare repo is unable to push to the staging server. It's nothing to do with the post-receive process itself, because i get the same error if i ssh onto the bare repo and do a manual push to the staging server from there:

Counting objects: 11, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 1.74 KiB, done.
Total 7 (delta 5), reused 0 (delta 0)
error: unable to create temporary sha1 filename ./objects/51: No such file or directory

fatal: failed to write object
error: unpack failed: unpacker exited with error code
To ssh://deploy@our-staging-server.com/var/www/apps/e_learning_staging/www
 ! [remote rejected] develop -> develop (n/a (unpacker error))
error: failed to push some refs to 'ssh://deploy@our-staging-server.com/var/www/apps/e_learning_staging/www'

I can go to the staging server and pull from the bare repo there, and push to it for that matter. So "pull from A to B" works but "push from A to B" doesn't.

I've seen quite a few people having similar problems and have investigated the following issues:

1) different users: not an issue as the push is done to the deploy user, which is the only user anyone uses on the staging server.

2) file permissions: i've recursively chowned all files in .git to deploy:deploy (the user and group we use) and have recursively chmodded u+w,g+w onto all the files in .git

3) git-fsck,git-gc. I've done these on the repo and on the staging server.

4) new-file permissions: doing 'umask' on the staging server gives 0022, which is equivalent to u=rwx,g=rx,o=rx so that should be fine. Just in case i changed it to 0002, which now lets the group do anything as well as the user do anything, made no difference.

5) Setting sharedRepository=true in .git/config, on the staging server. I did this thinking that maybe it was necessary in order to push to it from the bare repo. Didn't make any difference (it was never set before when it all worked, anyway), so i took it out again.

6) git-repack: I tried a repack but was told there was nothing to pack.

7) Did git reset --hard on the staging server. Didn't help.

8) Haven't run out of disk space.

I feel like i've researched this and tried everything, it's doing me in. Can anyone suggest anything else i could try?

EDIT - i tried cloning the repo into a new folder on the staging server, and changing the bare repo's git config to point to that new folder in the definition for the "staging_server" remote. I then pushed to the bare repo from my local machine, and then tried to push from the repo to the staging server, and got the same problem:

error: unable to create temporary sha1 filename ./objects/26: No such file or directory

There is no objects/26 folder in the .git folder on the staging server, but i don't know why it's failing to make one.

解决方案

Found out what it was, and feel like a dumbass as a result.

Originally, on the staging box, the git repo was outside of the application folder. In order to make this work, there was an option we added to the git config, of

worktree = /path/to/app/folder

At some point, we decided to move the git repo into the actual working folder, in a .git folder as usual. The above option was still in the config, and even though it was the right folder, the fact that it was there at all was what was stopping the unpacker from working. Once i took that option out of the config then it worked straight away. Doh.

这篇关于解包器错误Git-从裸回购推送到登台服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆