Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Debian, Git server, Nginx, Fcgiwrap, and git push can not create remote object directory

13 views
Skip to first unread message

David Mehler

unread,
Sep 9, 2023, 4:40:06 PM9/9/23
to
Hello,

I'm trying to set up a git server on Debian 12, served by Nginx via
https. I used this as a debian-specific starter though I have done
this in the past using a FreeBSD and Apache type setup:

https://esc.sh/blog/setting-up-a-git-http-server-with-nginx/

The client is a windows 10 client. All goes right until I try to push
changes to the server main branch and I get this:

git push origin main
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Writing objects: 100% (4/4), 276 bytes | 276.00 KiB/s, done.
Total 4 (delta 0), reused 4 (delta 0), pack-reused 0
error: remote unpack failed: unable to create temporary object directory
To https://git.domain.com/repo1.git
! [remote rejected] main -> main (unpacker error)
error: failed to push some refs to 'https://git.domain.com/repo1.git'

I've installed Nginx from the Nginx Debian repo so it's running as
user Nginx not as www-data, but permissions are set to allow user
nginx read/write to the /srv/git and subdirectories.

Googling shows issues where a incoming-xxx directory under objects
needs to be made as a sort-of-quarantine directory prior to commiting
the files, I don't see that area at all.

Specific commands used (server)
apt install git nginx fcgiwrap
mkdir -pv /srv/git
cd /srv/git
mkdir -pv repo1.git
cd repo1.git
git config --global init.defaultBranch "main"
git init . --bare --shared
git update-server-info
Enable git push so http commits to the repository can be performed.
Add the following entry to the /srv/git/repo1.git/config file
[http]
receivepack = true
git config --bool core.bare true
chown -R nginx:nginx /srv/git
chmod -R 775 /srv/git

nginx configuration file:

server {
listen 443 ssl http2;

server_name git.domain.com;

access_log /var/log/nginx/git.domain.access.log main;
error_log /var/log/nginx/git.domain.error error;

# TLS/SSL CONFIG
# RSA certificates (dual config)
ssl_certificate /etc/ssl/domain.com/domain.com.fullchain.crt;
ssl_certificate_key /etc/ssl/domain.com/domain.com.key;

# ECC/ECDSA certificates (dual config)
ssl_certificate /etc/ssl/domain.com/domain.com.fullchain.crt.ecc;
ssl_certificate_key /etc/ssl/domain.com/domain.com.key.ecc;
ssl_session_cache shared:domainSSL:50m;
ssl_dhparam /etc/ssl/domain.com/dhparams.pem;

# This is where the repositories live on the server
root /srv/git;

index index.php index.html index.htm index.nginx-debian.html;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

location ~ (/.*) {
client_max_body_size 0;
auth_basic "Git Login";
auth_basic_user_file /etc/nginx/.gitpasswd;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
# export all repositories under GIT_PROJECT_ROOT
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param GIT_PROJECT_ROOT /srv/git;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $1;
}

# Directives to send expires headers and turn off 404 error logging.
location ~* ^.+\.(css|js|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$
{
access_log off; log_not_found off; expires max;
}

# Pass PHP Scripts To FastCGI Server
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php8.2-fpm.sock; #depends on PHP versions
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Specific commands used (client)
mkdir my-project
cd my-project
git init
git remote add origin https://git.domain.com/repo1.git
mkdir dev
echo "This is a test file" > dev/file
git add .
git commit -a -m "Add files and directories"
git push origin main

If anyone has any suggestions I'd appreciate them.
Thanks.
Dave.

Geert Stappers

unread,
Sep 10, 2023, 3:00:08 AM9/10/23
to
On Sat, Sep 09, 2023 at 04:31:38PM -0400, David Mehler wrote:
> Hello,
>
> I'm trying to set up a git server on Debian 12, served by Nginx via
> https. I used this as a debian-specific starter though I have done
> this in the past using a FreeBSD and Apache type setup:
>
> https://esc.sh/blog/setting-up-a-git-http-server-with-nginx/

Which has: Alright, that’s it. Leave a comment if it didn’t work.


> The client is a windows 10 client.
> All goes right until I try to push changes to the server main branch

The above URL has no "`git push` works" statement,
it stops after "I could do `git clone`".


> and I get this:
>
> git push origin main
> Enumerating objects: 4, done.
> Counting objects: 100% (4/4), done.
> Writing objects: 100% (4/4), 276 bytes | 276.00 KiB/s, done.
> Total 4 (delta 0), reused 4 (delta 0), pack-reused 0
> error: remote unpack failed: unable to create temporary object directory
> To https://git.domain.com/repo1.git
> ! [remote rejected] main -> main (unpacker error)
> error: failed to push some refs to 'https://git.domain.com/repo1.git'

No sign of an user name.
Not even a request for an user name.


Regards
Geert Stappers
--
Silence is hard to parse
0 new messages