git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-push through git protocol

From
Linus Torvalds <torvalds@osdl.org>
Date
Jan 21, 2007, 19:04 UTC
Message-ID
<Pine.LNX.4.64.0701211034490.14248@woody.osdl.org>
In-Reply-To
<ep00nl$mop$1@sea.gmane.org>
On Sun, 21 Jan 2007, Jakub Narebski wrote:
Show 10 quoted lines
> > 
> > It seems there should be a way to configure a repo or the git daemon
> > to say "Allow push operations".
> > 
> > I looked through the release notes Junio posted for 1.5.0-rc2, but
> > found no reference to the git daemon.
> 
> git:// protocol is not authenticated. git by design allow push only through
> authenticated protocols, i.e. local, ssh:// (git+ssh://), http(s):// with
> WebDAV, probably in the future ftps://. 

Well, it _should_ actually be truly fairly trivial to allow pushing over the git:// protocol, and while it's not authenticated, I could well imagine that it would make sense from within a firewalled setup (where nobody but trusted internal people can reach the git port anyway).

So in that sense, I do think Bill's request makes some amount of sense.

At the same time, I suspect it's not a great idea, unless you also add *some* kind of logging facility to git-daemon.

But here is a trivial patch that *MAY* do what Bill wants.

NOTE! "git-receive-pack" is disabled by default, so you need to enable it explicitly by starting git-daemon with the "--enable=receive-pack" command line argument, or by having your config enable it automatically.

And a second note: I obviously didn't test it. I'm Linus. I don't do no steenking testing..

		Linus
---
diff --git a/daemon.c b/daemon.c
index f039534..9590372 100644
--- a/daemon.c
+++ b/daemon.c
@@ -372,9 +372,16 @@ static int upload_archive(void)
 	return -1;
 }
 
+static int receive_pack(void)
+{
+	execl_git_cmd("receive-pack", ".", NULL);
+	return -1;
+}
+
 static struct daemon_service daemon_service[] = {
 	{ "upload-archive", "uploadarch", upload_archive, 0, 1 },
 	{ "upload-pack", "uploadpack", upload_pack, 1, 1 },
+	{ "receive-pack", "receivepack", receive_pack, 0, 1 },
 };
 
 static void enable_service(const char *name, int ena) {
Previous: Jakub NarebskiNext: Bill Lear
Message 3 of 22 in “git-push through git protocol”
  1. Bill LearJan 21, 2007
  2. Jakub NarebskiJan 21, 2007
  3. Linus TorvaldsJan 21, 2007
  4. Bill LearJan 21, 2007
  5. Johannes SchindelinJan 21, 2007
  6. Bill LearJan 21, 2007
  7. Linus TorvaldsJan 21, 2007
  8. Linus TorvaldsJan 22, 2007
  9. Junio C HamanoJan 22, 2007
  10. Make sure git_connect() always give two file descriptors.Junio C Hamano, Jan 22, 2007
  11. Linus TorvaldsJan 22, 2007
  12. Bill LearJan 22, 2007
  13. Bill LearJan 22, 2007
  14. Linus TorvaldsJan 22, 2007
  15. Martin LanghoffJan 22, 2007
  16. Linus TorvaldsJan 22, 2007
  17. Bill LearJan 22, 2007
  18. Bill LearJan 22, 2007
  19. Martin LanghoffJan 21, 2007
  20. Bill LearJan 22, 2007
  21. Martin LanghoffJan 22, 2007
  22. Jakub NarebskiJan 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.