I have an online server (Ubuntu 17.04) that host my bare repos. I tried to set up HTTPS on this server, and I can pull but I can't push, it fails with the following error:
error: Cannot access URL https://user:[email protected]/REPO/, return code 22 fatal: git-http-push failed error: failed to push some refs to 'https://user:passwd@myserver/REPO/'
The nginx config relevant part looks like that:
# static repo files for cloning over https
location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx))$ {
client_max_body_size 0;
auth_basic "Restricted Area";
auth_basic_user_file /etc/apache2/.htpasswd;
fastcgi_param REMOTE_USER $remote_user;
root /home/git/;
}
# requests that need to go to git-http-backend
location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
client_max_body_size 0;
auth_basic "Restricted Area";
auth_basic_user_file /etc/apache2/.htpasswd;
root /home/git/;
#fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param PATH_INFO $uri;
fastcgi_param GIT_PROJECT_ROOT /home/git/;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
}
In all the thread I read the problem came from the REMOTE_USER fastcgi param or the local git config that lacked user/passwd in the remote URL, but I set up that so I am clueless. Does anyone have an idea or see a problem?
EDIT: Here is my .git/config:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[remote "origin"]
url = https://user:[email protected]/REPO/
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
[user]
name = git
Without reproducing your setup, are you sure that
receivepack
is correctly enabled, according to the documentation?And what if you try to update your local
.git/config
URL like in this post (look at the comment)