Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've set up a remote git repository on my server. Here's file and directory structure

/var/lib/git/myproject1 ## the git repository for myproject1
/var/lib/git/myproject2 ## the git repository for myproject2

/var/www/  ## symbolic link to /var/lib/git/myproject1
/var/www/  ## symbolic link to /var/lib/git/myproject2

Here's what my .gitconfig looks like

    excludesfile = /var/www/.gitignore
        name = webguy
        email =

So from my localhost I successfully ran a git pull mypro1 master, where mypro1 points to The pull downloaded all the files from the remote repository as expected. But when I do a git push mypro1 master, I get the error

Cannot access URL, return code 22 fatal: git-http-push failed 

I get the same error with myproject2 repository.

Did I set up git or apache incorrectly?

share|improve this question
up vote 1 down vote accepted

You'll need to enable dav to actively push changes over http. Check out the official git server over http guide for details on how to install it, and other things you may have missed.

share|improve this answer

Edit the following section of your .git/config file:

[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = http://git.repository.url/repo.git


[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = http://username:password@git.repository.url/repo.git

Then try git push origin master.

Edit the authentication details in your config files for other repository URLs as required and push to the required branch.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.