Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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/mywebwebsite.com/public_html/myproject1  ## symbolic link to /var/lib/git/myproject1
/var/www/mywebwebsite.com/public_html/myproject2  ## symbolic link to /var/lib/git/myproject2

Here's what my .gitconfig looks like

[core]
    excludesfile = /var/www/.gitignore
[user]
        name = webguy
        email = support@mywebsite.com

So from my localhost I successfully ran a git pull mypro1 master, where mypro1 points to http://mywebsite.com/myproject1. 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 http://mywebsite.com/myproject1/, 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
add comment

2 Answers

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
add comment

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

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

to

[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
add comment

Your Answer

 
discard

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.