Home > nginx > NGINX + Git push = 403

NGINX + Git push = 403

March 8Hits:3

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;         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: - - [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" - 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?


$ git clone http://user:[email protected]/local.git
Cloning into 'local'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.

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:

git push --set-upstream origin master

then push.

Tags:git, nginx

Related Articles

  • NGINX + Git push = 403March 8

    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-modul

  • Error 403 when git push (multiple github accounts on the same mac)September 7

    I have two GitHub accounts on the same Mac. And have credential-osxkeychain installed. It works fine with my first GitHub account. But, how can I add the second account into the keychain access? If it is not possible, how can I 'logout' my first acco

  • How to make git push work with nginx (basic auth) behind nginx reverse proxy (HTTPS)?April 2

    I like to have a git server on a computer (backend) without direct internet access. There should be basic authentication. The access should be available by means of a reverse proxy (frontend) on another computer, that does SSL/HTTPS. Both are running

  • centos 5 + nginx + git-http-backendFebruary 21

    I've a CentOS 5 server at domain.fr. I'm trying to set a subdomain so that I can use it with git, "git.domain.fr". My repositories are in /home/git (example /home/git/repos.git). I've installed git-http-backend and nginx. I've set a repository l

  • git push fatal failed

    git push fatal failedOctober 16

    I somehow deleted the whole directory of my code branch. I cloned a new one. It worked fine except pushing. ~/workspace/wtf (mybranch)]$ git push origin mybranch error: Cannot access URL [my url], return code 22 fatal: git-http-push failed git pull w

  • What's a sensible workflow for deploying webserver content using git push?October 13

    I'd like to use git push to update my (nginx) webserver content, while still keeping things secure. One way I could do this would be to ssh to my server, git pull from bitbucket into /srv/www, and chown -R www-data:www-data .. It'd be slicker, though

  • git push hangs due to PDF file (797K)January 17

    I want to include a PDF file in the repo, which is currently 797K in size. But git push hangs after: Writing objects 100% Total 25 It freezes after x-git-receive-pack-result I have tried setting http.postBuffer to 524288000 but that doesn't work eith

  • Git push from post-receiveMay 28

    I have two servers, let's call them first and second. First one is where the real development is done, and second one should be the replica. What I would like to do is put "git push" in post-receive, but there is one problem. Post-receive is exe

  • Is possible to install nginx with push module on windows?August 24

    i have an application that make use of nginx and the Nginx Http Push Module (http://pushmodule.slact.net/). Today i use it on linux, but i want to use it on windows. Is there a way or a a pre-compiled package? --------------Solutions------------- Sho

  • What does "master" mean in "git push origin master"April 4

    I'm new to git as a version control system. I tried reading the documentation, but I don't understand what "master" means in the command "git push origin master". Can someone explain in very dumbed-down terms? Thanks --------------Solu

  • How do I use git-push --mirror with git-shell in SSH?May 9

    I am attempting to setup a mirror-to-backup hook in our repositories. The hook is executing a git push --mirror [email protected]:path/foo.git. However it fails stating: fatal: What do you think I am? A shell? fatal: The remote end hung up unexpectedly M

  • How can I recover from an accidental git push -f?June 16

    I just ran git push -f by mistake, thus overwriting a remote branch. Original: (remote origin:) branch master -> commit aaaaaaa branch foo -> commit bbbbbbb (local) branch master -> commit ccccccc branch foo -> commit ddddddd After git push -f

  • Git: push via ssh to a root owned repository with ssh root logins disabledNovember 17

    is that even possible? Summary, i'm running puppet master on a server and ideally we want root logins via ssh disabled, we want to force all access via sudo if root access required however we have puppet installed using a git repo to manage the manif

  • Does 'git push' create a new SSH session?December 3

    I've set up a new EC2 instance with Heroku-like deploy. I followed this article cuppster.com/2011/05/12/diy-node-js-server-on-amazon-ec2/. My problem is... If I push to the server several times, CPU jumps to 90%. I was wondering, what does it cause?

  • Which is better for website backup - rsync or git pushDecember 27

    I run 2 LAMP web servers at different providers for disaster recovery purposes - a high powered live server, and a low powered backup server. Currently I rsync all the data from the live server to the backup server once every 4 hours. This works ok,

  • Intermittently git push hangs over ssh to gitosisMarch 12

    I have an intermittent problem pushing to my git (gitosis) repository. Most of the time it works fine but when it doesn't work the push hangs. It seems to have done the majority of what it wants to do: $ git push Counting objects: 67, done. Delta com

  • Is there anyway to color `git push` output?March 16

    I've tried using: stderred, https://github.com/sickill/stderred colors in git, http://scie.nti.st/2007/5/2/colors-in-git global config color.ui=true. Though the output from git push on error is all white. Everything in my ZSH is colored and this look

  • how to perform git push using crontabApril 1

    I'm using crontab for synchronizing git repositories. I was able to do operations like git add and commit, but can't perform git push to origin, since every git push asks for a password. How can I connect to the server using git push using cron? ----

  • MKCOL 405 and LOCK 500 on git push (error: cannot lock existing info/refs)July 28

    I'm having some troubles setting up a Git server with apache. Here is my gitrepo.conf: DavLockDB "opt/local/apache2/var/DavLock" <Directory /opt/local/apache2/htdocs/repo> DAV On Deny from all AuthType Basic AuthName "Git repositories

  • Reimport ssh certificate after every reboot for GIT PUSH over ssh to workAugust 23

    I am using OSX 10.8 on my macbook air, i have git configured to push my repository to an EC2 instance via ssh. Everything works fine with that. The only issue is that after every reboot, I have to ssh-add certname.pem in order to allow GIT to connect

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.346 s.