1

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 = [email protected]

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?

2 Answers 2

2

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.

0

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:[email protected]/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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .