{"thread":{"id":"3076","subject":"Starting a new project remotely","startedAt":"2006-01-15T18:45:01Z","lastAt":"2006-01-15T20:01:58Z","messageCount":3,"participants":["Daniel Barkalow","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"14686","messageId":"Pine.LNX.4.64.0601151323320.25300@iabervon.org","threadId":"3076","inReplyTo":null,"subject":"Starting a new project remotely","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2006-01-15T18:45:01Z","receivedAt":"2006-01-15T18:45:01Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"Is there something currently that acts like git-clone, except that it sets \nup automatic connections in the opposite direction? That is, you run it in \na repository with no origin, and it pushes the data to the specified \nlocation (which probably needs to be set up already as an empty \nrepository) and sets the local side's origin remote to the location given.\n\nThis recipe seems to work:\n\n git branch origin master\n echo >$GIT_DIR/remotes/origin \\\n\"URL: $repo\nPull: $head_points_at:$origin\"\n git push origin $origin:refs/heads/$head_points_at\n\n(where $origin is \"origin\", $head_points_at is \"master\", $repo is the \ntarget repository, \"origin\" is the remote you want to create, and \"master\" \nis the head that currently holds the commit you want to push)\n\n\t-Daniel\n*This .sig left intentionally blank*\n"},{"id":"14688","messageId":"7vd5it47lr.fsf@assigned-by-dhcp.cox.net","threadId":"3076","inReplyTo":"Pine.LNX.4.64.0601151323320.25300@iabervon.org","subject":"Re: Starting a new project remotely","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-15T19:24:48Z","receivedAt":"2006-01-15T19:24:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Daniel Barkalow <barkalow@iabervon.org> writes:\n\n> Is there something currently that acts like git-clone, except that it sets \n> up automatic connections in the opposite direction? That is, you run it in \n> a repository with no origin, and it pushes the data to the specified \n> location (which probably needs to be set up already as an empty \n> repository) and sets the local side's origin remote to the location given.\n\nThe \"git push\" command allows you to push into an empty or even\nunrelated destination, but I do think there no wrapper that\ncreates remotes/ file.  BTW, calling that \"origin\" is probably\nconfusing.  In the scenario you outlined, your local side is the\nsource and the remote is the sink.\n\nFYI, here is what I have in my remotes/ko file to interact with\nmy kernel.org repository (the one that is mirrored out to the\npublic machines):\n\n        URL: zzz.kernel.org:/pub/scm/git/git.git/\n        Push: master\n        Push: +pu\n        Push: maint\n        Pull: master:refs/tags/ko-master\n        Pull: +pu:refs/tags/ko-pu\n        Pull: maint:refs/tags/ko-maint\n\nand with this, I first run\n\n\t$ git fetch ko\n\t$ git show-branch master ko-master\n\nto make sure I am not rewinding what I have already pushed out\nby mistake, and then\n\n\t$ git push ko\n        $ git push --tags ko ;# if I added a new tag\n"},{"id":"14691","messageId":"Pine.LNX.4.64.0601151437240.25300@iabervon.org","threadId":"3076","inReplyTo":"7vd5it47lr.fsf@assigned-by-dhcp.cox.net","subject":"Re: Starting a new project remotely","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2006-01-15T20:01:58Z","receivedAt":"2006-01-15T20:01:58Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Sun, 15 Jan 2006, Junio C Hamano wrote:\n\n> Daniel Barkalow <barkalow@iabervon.org> writes:\n> \n> > Is there something currently that acts like git-clone, except that it sets \n> > up automatic connections in the opposite direction? That is, you run it in \n> > a repository with no origin, and it pushes the data to the specified \n> > location (which probably needs to be set up already as an empty \n> > repository) and sets the local side's origin remote to the location given.\n> \n> The \"git push\" command allows you to push into an empty or even\n> unrelated destination, but I do think there no wrapper that\n> creates remotes/ file.  BTW, calling that \"origin\" is probably\n> confusing.  In the scenario you outlined, your local side is the\n> source and the remote is the sink.\n\nMy general pattern is that I have an \"origin\" repository, which is public \nand central. I do work in various other repositories, and push the results \nto origin when I finish them. I create these with \"git clone\", so the \ncentral point is called \"origin\" in each clone.\n\nThe odd case is when I start out; I have a repository with the initial \ncommit, and \"origin\" is blank. The desired result is that the central \nlocation gets this commit, and the repository I'm starting from becomes \nidentical to any clone of the central location.\n\nI don't create the initial commit in the central location because there's \nno working tree there, and it's a pain to prepare a commit without one. I \nsuppose the alternative is to support cloning a blank repository, so I \ncould prepare the initial commit just like any later one.\n\nIncidentally, I think it would be useful to have a script that creates a \nremotes/ file given a command line like push or pull. Then you could use \n\"git pull\" with a long command line until you were happy with the \nbehavior, and then make a shortcut out of it. It'd also be nice to have \nthe command list the remotes for you as well. If anyone's in the mood for \nscripting and wants something to work on...\n\n\t-Daniel\n*This .sig left intentionally blank*\n"}]}