我希望使用 python -m "SimpleHTTPServer"
命令推送到托管在 http://localhost:8000/tehCode.git
上的 git 存储库。
我收到一个错误
error: Cannot access URL http://localhost:8000/tehCode.git/, return code 22
fatal: git-http-push failed
我可以很好地克隆此存储库,但无法推送到它。 假设我仍想使用 Python SimpleHTTPServer,我该怎么做?
我已经看过了
- Cannot push Git to remote repository with http/https
- https://superuser.com/questions/473177/git-push-fatal-failed
但他们似乎在使用 Apache,并且大多数解决方案都是通过编辑 Apache 的配置文件。
最佳答案
当使用 SimpleHTTPServer 时,您使用的是所谓的哑 http 协议(protocol)。之所以称为 dumb,是因为它对 git 完全一无所知。因此,推送到这样的服务器是行不通的,因为 http 服务器不知道如何处理 git 发出的请求。
Git 有一个名为 git-http-backend 的 cgi 脚本,它允许使用智能 http 协议(protocol)推送 http。
我没有这方面的经验,但你可以看看 pythons CGIHTTPServer您可以将其定向到 git-http-backend。
但最简单的方法是使用 apache .
关于git - 通过 HTTP 推送到本地托管的 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15974286/