Reputation: 25
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.
I have installed nginx and fastcgi. And those are the following configurations of the git files
/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)
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)
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)?
Upvotes: 0
Views: 274
Reputation: 25
Solved by myself:
Make the ownership of the repo to 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!
Therefore, I changed the ownership to the user:group corresponding.
Thanks!
Upvotes: 1