【发布时间】:2011-12-23 07:09:25
【问题描述】:
与Git pull error: unable to create temporary sha1 filename相关
大家好。一段时间以来,我们已经将我们的应用程序放在一个 git 项目中,并且在不同的服务器上有一个裸仓库。裸仓库有一个 post-receive 钩子,可以将其推送到我们的登台服务器,而该服务器又具有一个 post-recieve 钩子来完成与部署相关的所有工作。一切正常,但现在裸仓库无法推送到登台服务器。这与接收后过程本身无关,因为如果我 ssh 到裸仓库并从那里手动推送到登台服务器,我会得到同样的错误:
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'
我可以去登台服务器并从那里的裸仓库中提取,然后推送到它。所以“从 A 拉到 B”有效,但“从 A 推到 B”无效。
我见过不少人有类似的问题,并调查了以下问题:
1) 不同的用户:这不是问题,因为推送是向部署用户完成的,这是任何人在登台服务器上使用的唯一用户。
2) 文件权限:我已经递归地将 .git 中的所有文件部署:deploy(我们使用的用户和组)并递归地 chmodded u+w,g+w 到 .git 中的所有文件
3) git-fsck,git-gc。我已经在 repo 和登台服务器上完成了这些。
4) 新文件权限:在登台服务器上执行“umask”会得到 0022,相当于u=rwx,g=rx,o=rx,所以应该没问题。以防万一我将其更改为 0002,它现在可以让组做任何事情,就像用户做任何事情一样,没有任何区别。
5) 在暂存服务器上的 .git/config 中设置 sharedRepository=true。我这样做是想也许有必要从裸仓库推送到它。没有任何区别(无论如何,它之前从未设置过),所以我又把它拿出来了。
6) git-repack:我尝试重新打包,但被告知没有要打包的东西。
7) git reset --hard 在登台服务器上。没有帮助。
8) 没有用完磁盘空间。
我觉得我已经对此进行了研究并尝试了所有方法,这让我很受用。谁能建议我可以尝试的其他方法?
编辑-我尝试将存储库克隆到登台服务器上的新文件夹中,并将裸存储库的 git 配置更改为指向“staging_server”远程定义中的新文件夹。然后我从本地机器推送到裸仓库,然后尝试从仓库推送到登台服务器,并遇到了同样的问题:
error: unable to create temporary sha1 filename ./objects/26: No such file or directory
暂存服务器上的 .git 文件夹中没有 objects/26 文件夹,但我不知道为什么它无法创建。
【问题讨论】:
-
考虑在您有用的检查列表中添加“解包时没有耗尽内存”,以使未来的读者受益:)