What does git mean by, “unable to migrate objects to permanent storage”?

之前偶尔发现提交代码会出现被拒绝情况,一开始以为可以用 gc 来解决问题,或者通过创建创建新分支或者重新提交代码来规避,然后发现被拒绝概率越来越高。遇到问题解决问题。

各种 google、百度加 stackOverflow,终于在 stackOverflow 上面看到一种解释,主要针对较高版本 git 和 gitlab,本地在提交 commit 的时候需要先提交到 tmp_objdir_migrate 然后再提交到仓库里面

     * Now we'll start writing out refs, which means the objects need
     * to be in their final positions so that other processes can see them.
    if (tmp_objdir_migrate(tmp_objdir) < 0) {
        for (cmd = commands; cmd; cmd = cmd->next) {
            if (!cmd->error_string)
                cmd->error_string = "unable to migrate objects to permanent storage";
tmp_objdir = NULL;

Quarantine Environment

When receive-pack takes in objects, they are placed into a temporary “quarantine” directory within the $GIT_DIR/objects directory and migrated into the main object store only after the pre-receive hook has completed. If the push fails before then, the temporary directory is removed entirely.

This has a few user-visible effects and caveats:

  1. Pushes which fail due to problems with the incoming pack, missing objects, or due to the pre-receive hook will not leave any on-disk data. This is usually helpful to prevent repeated failed pushes from filling up your disk, but can make debugging more challenging.
  2. Any objects created by the pre-receive hook will be created in the quarantine directory (and migrated only if it succeeds).
  3. The pre-receive hook MUST NOT update any refs to point to quarantined objects. Other programs accessing the repository will not be able to see the objects (and if the pre-receive hook fails, those refs would become corrupted).

根据被拒绝的 log:./objects/c5/77e0eb9f2a855232d6b26e957ad71c431fdbaa: Permission denied 我们知道这个目录文件夹出问题了,于是我们想去找到服务器项目所在的路径,发现里面空空如也,一般项目路径下面会有 xx.git 代表这个仓库所在文件夹,然而没有,貌似只有 @hash 里面有很多不规则命名的文件夹。

一开始以为 git 文件夹被谁意外删掉了,然而 gitlab 网页加载正常,完全没有被删掉的异常表现。之前修复问题的时候弄坏过 git 项目,弄坏了的 git 项目,网页是会加载失败。

于是去看看 gitlab 相关知识,看了相关文档,原来项目路径都被放到 @hash 这个文件夹下面了,要查到项目具体路径,提供了两种方法,一种是通过 gitlab 网页客户端的 admin 后台,另外一种是通过 gitlab rail 命令行后台,通过

Project.find(16).disk_path // id 可以到项目设置里面看得到,不需要太高权限



于是找到路径,查看项目的 c5 路径权限,权限果然不对,所有者居然是 root 不是 git,导致 git 写入失败,最终通过修改文件夹所有者改为 git 之后,提交成功

gitlab hash 文件夹文档:https://docs.gitlab.com/ee/administration/repository_storage_types.html

Linux 文件夹权限说明:

git push 失败 Stack Overflow 资料:

Install WordPress on Ubuntu fast tutorial

Install WordPress on Ubuntu

> apt install nginx

> ufw allow ‘Nginx HTTP’

> apt install mysql-server

> apt install php-fpm php-mysql

> nano /etc/php/7.2/fpm/php.ini

update as `cgi.fix_pathinfo=0`

> systemctl restart php7.2-fpm

> nano /etc/nginx/sites-available/default

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    root /var/www/html;
    index index.php index.html index.htm index.nginx-debian.html;
    server_name server_domain_or_IP;
    location / {
        try_files $uri $uri/ =404;
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.2-fpm.sock; # your php’s sock runtime path
    location ~ /\.ht {
        deny all;

> systemctl reload nginx