无法访问URL http://mywebsite.com/myproject/,返回代码22致命:git-http-push失败

我在我的服务器上build立了一个远程的git仓库。 这里是文件和目录结构

/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 

这是我的.gitconfig的样子

 [core] excludesfile = /var/www/.gitignore [user] name = webguy email = [email protected] 

所以从我的本地主机,我成功地运行了一个git pull mypro1 master ,其中mypro1指向http://mywebsite.com/myproject1 。 拉按预期从远程存储库下载所有文件。 但是当我做一个git push mypro1 master ,我得到的错误

 Cannot access URL http://mywebsite.com/myproject1/, return code 22 fatal: git-http-push failed 

我得到与myproject2存储库相同的错误。

我错误地设置了git或apache吗?

你需要启用dav来主动推送对http的修改。 通过http指南查看官方的git服务器了解如何安装它的细节,以及其他你可能错过的东西。

编辑.git / config文件的以下部分:

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

然后尝试git push origin master

根据需要在您的configuration文件中编辑其他存储库URL的身份validation详细信息,并推送到所需的分支。