[英]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
用户拥有(这可能是问题所在)?
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.