Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pushing to a git repository hosted locally over HTTP

Tags:

git

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.

like image 572
ffledgling Avatar asked Apr 12 '13 14:04

ffledgling


People also ask

How do I push changes to a git repository locally?

To push changes from the current branch press Ctrl+Shift+K or choose Git | Push from the main menu. To push changes from any local branch that has a remote, select this branch in the Branches popup and choose Push from the list of actions.

Does git work over HTTP?

Git supports two HTTP based transfer protocols. A "dumb" protocol which requires only a standard HTTP server on the server end of the connection, and a "smart" protocol which requires a Git aware CGI (or server module).


1 Answers

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.

like image 138
Ikke Avatar answered Oct 20 '22 01:10

Ikke