简体   繁体   English

Git 服务器无法推送。 无法创建临时 object 目录

[英]Git server cannot push. Unable to create temporary object directory

Good afternoon,下午好,

I'm trying to come up with my own hosted git server and I am having trouble configuring the git options with HTTPs.我试图想出我自己托管的 git 服务器,但我在使用 HTTPs 配置 git 选项时遇到问题。

I have installed nginx and fastcgi.我已经安装了 nginx 和 fastcgi。 And those are the following configurations of the git files这些是 git 文件的以下配置

/etc/nginx/nginx.conf /etc/nginx/nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
}

http {
        sendfile on;
        tcp_nopush on;
        types_hash_max_size 2048;
        server_tokens off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        gzip on;

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;

        server {
                listen 80;
                listen [::]:80;

                return 301 https://$host$request_uri;
        }
}

/etc/nginx/sites-available/default (linked to /etc/nginx/sites-enabled/default) /etc/nginx/sites-available/default(链接到/etc/nginx/sites-enabled/default)

server {
        listen 443 ssl default_server;
        listen [::]:443 ssl default_server;

        ssl_certificate /etc/letsencrypt/live/[redacted]/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/[redacted]/privkey.pem;

        root /var/www/html;
        server_name [redacted] www.[redacted];
}

/etc/nginx/sites-available/git (same as before, linked) /etc/nginx/sites-available/git (和以前一样,链接)

git@localhost:/$ cat /etc/nginx/sites-available/git 
server {
        listen 443 ssl;
        listen [::]:443 ssl;

        ssl_certificate /etc/letsencrypt/live/[redacted]/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/[redacted]/privkey.pem;

    server_name git.[redacted];

    auth_basic "login";
    auth_basic_user_file "/var/www/html/git/.htpasswd";
    location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
        client_max_body_size 0;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
        fastcgi_param GIT_HTTP_EXPORT_ALL "";
        fastcgi_param GIT_PROJECT_ROOT /git;
        fastcgi_param REMOTE_USER $remote_user;
        fastcgi_param PATH_INFO $uri;
        fastcgi_pass  unix:/var/run/fcgiwrap.socket;
    }
}

And everytime I try to push some commits I get:每次我尝试推送一些提交时,我都会得到:

error: remote unpack failed: unable to create temporary object directory
To https://git.[redacted]/[repo]
! [remote rejected] main -> main (unpacker error)
error: failed to push some refs to https://git.[redacted]/[repo]

The directory where git projects are allocated is owned full by the git user (is that maybe the problem)?分配 git 项目的目录完全由git用户拥有(这可能是问题所在)?

  • Reenabling many times both services.多次重新启用这两项服务。
  • Restructuring the /etc/nginx/sites-available/git and the default.重组 /etc/nginx/sites-available/git 和默认值。
  • Resetting the user(s) for the auth_basic为 auth_basic 重置用户
  • Ownership of the folders.文件夹的所有权。
  • Changing the branches.改变分支。

Solved by myself:自己解决:

Make the ownership of the repo to git:www-data.将 repo 的所有权设为 git:www-data。 The problem as @eftshift0 pointed out, or at least guided to, was who was running the git process and who has ownership on top of the repo!正如 @eftshift0 所指出的,或者至少是指导过的,问题是谁在运行 git 进程以及谁在回购协议之上拥有所有权!

Therefore, I changed the ownership to the user:group corresponding.因此,我将所有权更改为对应的用户:组。

Thanks!谢谢!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Git 错误:远程解包失败:无法创建临时对象目录 - 尝试推送到远程存储库时 - Git Error: remote unpack failed: unable to create temporary object directory - While attempting to push to remote repository 主分支4领先。 无法推送。 吉特 - Master branch 4 ahead. Cannot push. Git Git,错误:远程解压失败:无法创建临时目录 object - 通过创建新分支 - Git, error: remote unpack failed: unable to create temporary object directory - By creating new Branch Git:无法创建临时 object 目录 - 尽管文件夹的权限设置为所有人? - Git: unable to create temporary object directory - altough permissions of the folder are set to everyone? git - 无法创建临时文件:没有这样的文件或目录 - 仅适用于某些文件? - git - unable to create temporary file: no such file or directory - only for certain files? ssh github工作,但不是git push。 - ssh github works, but not git push. git推。 密码/帐户被锁定? - git push. Password/account locked? 推送到 Azure VM 时无法创建临时 object 目录 - Unable to create temporary object directory when pushing to Azure VM Openshift:修改代码和Git推送后。 变化没有显示 - Openshift: After modifying code and Git push. Changes dont show 在Windows中克隆git信息库时显示错误:无法创建临时文件:没有这样的文件或目录 - while cloning git repository in windows show error : unable to create temporary file: No such file or directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM