I have Git repo on remote box, configured with NGINX + uWSGI.
Nginx compiled with:
# nginx -V
nginx version: nginx/1.6.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC)
configure arguments: --with-http_dav_module --add-module=nginx-dav-ext-module-master --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --user=nginx --group=nginx
Nginx config:
server {
listen 80;
server_name git.domain.local;
root /var/gitrepo;
access_log /var/log/nginx/git_access.log;
error_log /var/log/nginx/git_error.log;
location / {
auth_basic "Password-protected Area";
auth_basic_user_file /var/gitrepo/.htpasswd;
include uwsgi_params;
uwsgi_pass 127.0.0.1:9090;
uwsgi_modifier1 9;
uwsgi_param GIT_HTTP_EXPORT_ALL "";
uwsgi_param GIT_PROJECT_ROOT /var/gitrepo;
uwsgi_param PATH_INFO $uri;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;
}
}
I can clone repo:
$ git clone http://user:[email protected]/local.git
Cloning into 'local'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
But - can't push
:
$ touch file
$ git add .
$ git commit -m 'sdc'
[master (root-commit) 442fda3] 'sdc'
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file
$ git push http://user:[email protected]/local.git master
fatal: unable to access 'http://user:[email protected]/local.git/': The requested URL returned error: 403
Nginx says only:
192.168.1.146 - - [08/Mar/2015:18:48:29 +0200] "GET /local.git/info/refs?service=git-receive-pack HTTP/1.1" 401 194 "-" "git/1.9.5.msysgit.0"
192.168.1.146 - user [08/Mar/2015:18:48:29 +0200] "GET /local.git/info/refs?service=git-receive-pack HTTP/1.1" 403 5 "-" "git/1.9.5.msysgit.0"
Local Git config:
$ git config --list
core.symlinks=false
core.autocrlf=input
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
pack.packsizelimit=2g
help.format=html
http.sslcainfo=/bin/curl-ca-bundle.crt
sendemail.smtpserver=/bin/msmtp.exe
diff.astextplain.textconv=astextplain
rebase.autosquash=true
[email protected]
user.name=Your Name
gui.recentrepo=C:/Users/setevoy/Documents/GIT repos/gg
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
core.hidedotfiles=dotGitOnly
remote.origin.url=http://user:[email protected]/local.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
I'm surprised, because same configuration works on my other host in office... What I'm doing wrong here?
According to the above it appears you are cloning an empty repository which wouldn't allow you to push. Make sure you are not cloning an empty repo.
If this is the initial commit however:
then push.