6

I wish to push to a git repository hosted on http://localhost:8000/tehCode.git servered using the python -m "SimpleHTTPServer" command.

I receive an error

error: Cannot access URL http://localhost:8000/tehCode.git/, return code 22
fatal: git-http-push failed

I can clone this repository just fine, but I can't push to it. How can I do this assuming I want to still use the Python SimpleHTTPServer ?

I've already looked at

  1. Cannot push Git to remote repository with http/https
  2. https://superuser.com/questions/473177/git-push-fatal-failed

But they seem to be working with Apache and most of the solutions are by editing Apache's config file.

Community
  • 1
  • 1
ffledgling
  • 11,502
  • 8
  • 47
  • 69
  • Just out of curiosity, why are you hosting a repo on a server, locally? – MMM Apr 12 '13 at 14:43
  • Trying to setup a continuous Integration testing platform. – ffledgling Apr 12 '13 at 14:45
  • I have no idea what HTTP method git push would use, but that's not important. What's important is that *you* have an idea, and then *show us* what you tried to implement for that. Does your server implement the correct method handler at all? – Martijn Pieters Apr 12 '13 at 14:48
  • I haven't written any method handlers for the server, git update-server-info seems to generate all the required urls. I don't have much knowledge about what git update-server-info does, But now that you mention it, there doesn't seem to be any method in the server itself to handle a git upload request. – ffledgling Apr 12 '13 at 14:56

2 Answers2

4

When using a SimpleHTTPServer, you are using the so called dumb http protocol. It is called dumb because it has no knowledge about git at all. Because of that, pushing to such a server does not work, because the http server has no clue what to do with the request git is making.

Git has a cgi script, called git-http-backend, which is made to allow for pushing over http by using the smart http protocol.

I have no experience with this, but you could look at pythons CGIHTTPServer which you could direct to git-http-backend.

But the easiest way is to use apache.

Community
  • 1
  • 1
Ikke
  • 99,403
  • 23
  • 97
  • 120
-1

Why use HTTP if it is local? Could just git push where/the/repo/lives should do.

vonbrand
  • 11,412
  • 8
  • 32
  • 52