无法使用http/https将Git推送到远程存储库

Clé*_*ent 21 git https push http

我在服务器上由apache提供服务的目录中有一个Git存储库.我已经配置了WebDAV,它似乎正在运行.Litmus返回100%的成功.

我可以从远程主机克隆我的存储库,但在尝试推送http或https时,我收到以下错误:

错误:无法访问网址 https://git.example.com/repo/,返回代码22致命:git-http-push failed

任何的想法?

Dee*_*pak 35

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

[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = http://git.repository.url/repo.git
Run Code Online (Sandbox Code Playgroud)

[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = http://username:password@git.repository.url/repo.git
Run Code Online (Sandbox Code Playgroud)

然后试试git push origin master.

根据需要在配置文件中编辑其他存储库URL的身份验证详细信息,然后推送到所需的分支.


Arr*_*ter 11

强烈建议尽可能不使用WebDAV.如果必须使用HTTP/HTTPS,则建议通过WebDAV 使用git-http-backend CGI脚本.

  • 你是绝对正确的,我读了一本旧手册,里面没有提到git-http-backend.所以我放弃了WebDAV并对其进行了配置.它更容易,更清洁,而且有效! (3认同)