{"thread":{"id":"10704","subject":"git push refspec problem","startedAt":"2007-11-07T15:01:53Z","lastAt":"2007-11-07T20:40:40Z","messageCount":10,"participants":["James","Johannes Schindelin","Pierre Habouzit","Johannes Gilger","Daniel Barkalow"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"58680","messageId":"7B37E361-9606-447C-B853-001182688AFA@nc.rr.com","threadId":"10704","inReplyTo":null,"subject":"git push refspec problem","fromName":"James","fromEmail":"jtp@nc.rr.com","sentAt":"2007-11-07T15:01:53Z","receivedAt":"2007-11-07T15:01:53Z","isPatch":false,"sender":{"key":"jtp@nc.rr.com","avatar":null},"body":"Hi,\n\nI'm trying to set up my git configuration file in one of my projects  \nso that I can do a simple \"git push\" to update my project on the git  \nserver.\n\nCurrently, I run the following command to push my updates (and it  \nworks just fine):\n\ngit push james@my.server.com:~/scm/git/project.git/\n\nIn my .git/config file, I've added a line for push, as follows:\n\n[remote \"origin\"]\n         url = git://my.server.com/project.git\n         fetch = +refs/heads/*:refs/remotes/origin/*\n         push = ssh://james@my.server.com/home/james/scm/git/ \nproject.git/\n\nWhen I run a \"git push\", it comes back with this error:\n\nfatal: remote part of refspec is not a valid name in ssh://james@my.server.com/home/james/scm/git/project.git/\n\nI've looked at this git push documentation:\n\nhttp://www.kernel.org/pub/software/scm/git/docs/git-push.html\n\nand it seems like my refspec is indeed correct.  (or so I thought ;))   \nAny ideas on what I'm doing wrong?\n\nThanks!\n.james\n"},{"id":"58682","messageId":"Pine.LNX.4.64.0711071510480.4362@racer.site","threadId":"10704","inReplyTo":"7B37E361-9606-447C-B853-001182688AFA@nc.rr.com","subject":"Re: git push refspec problem","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-07T15:11:46Z","receivedAt":"2007-11-07T15:11:46Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Nov 2007, James wrote:\n\n>        fetch = +refs/heads/*:refs/remotes/origin/*\n\nThis is a refspec.\n\n>        push = ssh://james@my.server.com/home/james/scm/git/project.git/\n\nThis is a URL.  It does not specify any refs.  But \"push =\" expects a URL.\n\nYou probably want to setup a different remote if you want to push to a \ndifferent URL than you are fetching from.\n\nHth,\nDscho\n"},{"id":"58684","messageId":"20071107152003.GL18057@artemis.corp","threadId":"10704","inReplyTo":"Pine.LNX.4.64.0711071510480.4362@racer.site","subject":"Re: git push refspec problem","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-11-07T15:20:03Z","receivedAt":"2007-11-07T15:20:03Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Wed, Nov 07, 2007 at 03:11:46PM +0000, Johannes Schindelin wrote:\n> Hi,\n> \n> On Wed, 7 Nov 2007, James wrote:\n> \n> >        fetch = +refs/heads/*:refs/remotes/origin/*\n> \n> This is a refspec.\n> \n> >        push = ssh://james@my.server.com/home/james/scm/git/project.git/\n> \n> This is a URL.  It does not specify any refs.  But \"push =\" expects a URL.\n> \n> You probably want to setup a different remote if you want to push to a \n> different URL than you are fetching from.\n\n  Oh, there is no way to pull through git:// and push to ssh://\nperfectly knowint it's the same physical repository so that the fetch\ndoesn't have the ssh-handhshake-overhead ?\n\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"58686","messageId":"4731D852.2080500@hackvalue.de","threadId":"10704","inReplyTo":"Pine.LNX.4.64.0711071510480.4362@racer.site","subject":"Re: git push refspec problem","fromName":"Johannes Gilger","fromEmail":"heipei@hackvalue.de","sentAt":"2007-11-07T15:22:58Z","receivedAt":"2007-11-07T15:22:58Z","isPatch":false,"sender":{"key":"heipei@hackvalue.de","avatar":"https://avatars.githubusercontent.com/u/6072?v=4"},"body":"Johannes Schindelin wrote:\n> Hi,\n> \n> On Wed, 7 Nov 2007, James wrote:\n> \n>>        fetch = +refs/heads/*:refs/remotes/origin/*\n> \n> This is a refspec.\n> \n>>        push = ssh://james@my.server.com/home/james/scm/git/project.git/\n> \n> This is a URL.  It does not specify any refs.  But \"push =\" expects a URL.\n\nI think Johannes meant to say \"But 'push =' expects a refspec.\" (the\nmanpage even says so).\n\nAbout your problem: If you want to pull from a git:// repository and\npush to another with ssh:// (or in general when having two different\nrepositories for pushing and fetching) in my novice understanding\nyou would need two remotes. In your case, can't you just use your\nssh-url for fetching as well?\n\nRegards,\nJojo\n\n-- \nJohannes Gilger <heipei@hackvalue.de>\nhttp://hackvalue.de/heipei/\nGPG-Key: 0x42F6DE81\nGPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"58687","messageId":"EA230407-45F1-4F7E-8415-A43ECF940856@nc.rr.com","threadId":"10704","inReplyTo":"20071107152003.GL18057@artemis.corp","subject":"Re: git push refspec problem","fromName":"James","fromEmail":"jtp@nc.rr.com","sentAt":"2007-11-07T15:23:27Z","receivedAt":"2007-11-07T15:23:27Z","isPatch":false,"sender":{"key":"jtp@nc.rr.com","avatar":null},"body":"On Nov 7, 2007, at 10:20 AM, Pierre Habouzit wrote:\n\n> On Wed, Nov 07, 2007 at 03:11:46PM +0000, Johannes Schindelin wrote:\n>> Hi,\n>>\n>> On Wed, 7 Nov 2007, James wrote:\n>>\n>>>       fetch = +refs/heads/*:refs/remotes/origin/*\n>>\n>> This is a refspec.\n>>\n>>>       push = ssh://james@my.server.com/home/james/scm/git/project.git/\n>>\n>> This is a URL.  It does not specify any refs.  But \"push =\" expects  \n>> a URL.\n>>\n>> You probably want to setup a different remote if you want to push  \n>> to a\n>> different URL than you are fetching from.\n>\n>  Oh, there is no way to pull through git:// and push to ssh://\n> perfectly knowint it's the same physical repository so that the fetch\n> doesn't have the ssh-handhshake-overhead ?\n\n\nThere has to be *some* way of pulling through git and pushing through  \nssh with a simple \"git push\".  :-P  I'm doing it manually, after all.   \nI could have sworn I've read how to do its somewhere but have since  \nforgotten.\n\n\n> -- \n> ·O·  Pierre Habouzit\n> ··O                                                madcoder@debian.org\n> OOO                                                http://www.madism.org\n"},{"id":"58688","messageId":"4731D918.6040106@hackvalue.de","threadId":"10704","inReplyTo":"EA230407-45F1-4F7E-8415-A43ECF940856@nc.rr.com","subject":"Re: git push refspec problem","fromName":"Johannes Gilger","fromEmail":"heipei@hackvalue.de","sentAt":"2007-11-07T15:26:16Z","receivedAt":"2007-11-07T15:26:16Z","isPatch":false,"sender":{"key":"heipei@hackvalue.de","avatar":"https://avatars.githubusercontent.com/u/6072?v=4"},"body":"James wrote:\n> There has to be *some* way of pulling through git and pushing through\n> ssh with a simple \"git push\".  :-P  I'm doing it manually, after all.  I\n> could have sworn I've read how to do its somewhere but have since\n> forgotten.\n\nWould two remotes do the trick? One remote only has a fetch entry\nwhile the other one has a push entry.\n\nRegards,\nJojo\n\n-- \nJohannes Gilger <heipei@hackvalue.de>\nhttp://hackvalue.de/heipei/\nGPG-Key: 0x42F6DE81\nGPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"58690","messageId":"607586B5-7BA0-4018-9FB1-691C5E78D550@nc.rr.com","threadId":"10704","inReplyTo":"4731D852.2080500@hackvalue.de","subject":"Re: git push refspec problem","fromName":"James","fromEmail":"jtp@nc.rr.com","sentAt":"2007-11-07T15:30:33Z","receivedAt":"2007-11-07T15:30:33Z","isPatch":false,"sender":{"key":"jtp@nc.rr.com","avatar":null},"body":"\nOn Nov 7, 2007, at 10:22 AM, Johannes Gilger wrote:\n\n> Johannes Schindelin wrote:\n>> Hi,\n>>\n>> On Wed, 7 Nov 2007, James wrote:\n>>\n>>>       fetch = +refs/heads/*:refs/remotes/origin/*\n>>\n>> This is a refspec.\n>>\n>>>       push = ssh://james@my.server.com/home/james/scm/git/project.git/\n>>\n>> This is a URL.  It does not specify any refs.  But \"push =\" expects  \n>> a URL.\n>\n> I think Johannes meant to say \"But 'push =' expects a refspec.\" (the\n> manpage even says so).\n>\n> About your problem: If you want to pull from a git:// repository and\n> push to another with ssh:// (or in general when having two different\n> repositories for pushing and fetching) in my novice understanding\n> you would need two remotes. In your case, can't you just use your\n> ssh-url for fetching as well?\n>\n> Regards,\n> Jojo\n\n\nI guess I could use my ssh url for pulling, as well.  I simply figured  \nit would be easier to add an ssh URL for push (like I was doing  \nmanually) and be done with it.  But it doesn't seem there's a super  \nsimple solution (i.e., my syntax was wrong in the config file) to  \nusing git for pull and ssh for push.\n\n.james\n\n\n> -- \n> Johannes Gilger <heipei@hackvalue.de>\n> http://hackvalue.de/heipei/\n> GPG-Key: 0x42F6DE81\n> GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81\n"},{"id":"58692","messageId":"20071107153852.GM18057@artemis.corp","threadId":"10704","inReplyTo":"4731D918.6040106@hackvalue.de","subject":"Re: git push refspec problem","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-11-07T15:38:52Z","receivedAt":"2007-11-07T15:38:52Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Wed, Nov 07, 2007 at 03:26:16PM +0000, Johannes Gilger wrote:\n> James wrote:\n> > There has to be *some* way of pulling through git and pushing through\n> > ssh with a simple \"git push\".  :-P  I'm doing it manually, after all.  I\n> > could have sworn I've read how to do its somewhere but have since\n> > forgotten.\n> \n> Would two remotes do the trick? One remote only has a fetch entry\n> while the other one has a push entry.\n\n  Yes you can do that, but that means you have to spell out the remote\nname either for fetching or pushing which somehow sucks :)\n\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"58693","messageId":"Pine.LNX.4.64.0711071539100.4362@racer.site","threadId":"10704","inReplyTo":"4731D852.2080500@hackvalue.de","subject":"Re: git push refspec problem","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-11-07T15:39:30Z","receivedAt":"2007-11-07T15:39:30Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 7 Nov 2007, Johannes Gilger wrote:\n\n> Johannes Schindelin wrote:\n> \n> > On Wed, 7 Nov 2007, James wrote:\n> > \n> >>        fetch = +refs/heads/*:refs/remotes/origin/*\n> > \n> > This is a refspec.\n> > \n> >>        push = ssh://james@my.server.com/home/james/scm/git/project.git/\n> > \n> > This is a URL.  It does not specify any refs.  But \"push =\" expects a \n> > URL.\n> \n> I think Johannes meant to say \"But 'push =' expects a refspec.\" (the \n> manpage even says so).\n\nOf course.  Thanks.\n\nCiao,\nDscho\n"},{"id":"58716","messageId":"Pine.LNX.4.64.0711071533590.29952@iabervon.org","threadId":"10704","inReplyTo":"607586B5-7BA0-4018-9FB1-691C5E78D550@nc.rr.com","subject":"Re: git push refspec problem","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2007-11-07T20:40:40Z","receivedAt":"2007-11-07T20:40:40Z","isPatch":false,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"On Wed, 7 Nov 2007, James wrote:\n\n> On Nov 7, 2007, at 10:22 AM, Johannes Gilger wrote:\n> \n> >Johannes Schindelin wrote:\n> > >Hi,\n> > >\n> > >On Wed, 7 Nov 2007, James wrote:\n> > >\n> > > >      fetch = +refs/heads/*:refs/remotes/origin/*\n> > >\n> > >This is a refspec.\n> > >\n> > > >      push = ssh://james@my.server.com/home/james/scm/git/project.git/\n> > >\n> > >This is a URL.  It does not specify any refs.  But \"push =\" expects a URL.\n> >\n> >I think Johannes meant to say \"But 'push =' expects a refspec.\" (the\n> >manpage even says so).\n> >\n> >About your problem: If you want to pull from a git:// repository and\n> >push to another with ssh:// (or in general when having two different\n> >repositories for pushing and fetching) in my novice understanding\n> >you would need two remotes. In your case, can't you just use your\n> >ssh-url for fetching as well?\n> >\n> >Regards,\n> >Jojo\n> \n> \n> I guess I could use my ssh url for pulling, as well.  I simply figured it\n> would be easier to add an ssh URL for push (like I was doing manually) and be\n> done with it.  But it doesn't seem there's a super simple solution (i.e., my\n> syntax was wrong in the config file) to using git for pull and ssh for push.\n\nWe *should* be able to make the rules: fetch tries URLs until one works, \nand then ignores later ones; push uses, in turn, all URLs that support \npushing.\n\nThen you could just list both URLs, with the \"git:\" one first, and it \nwould do what you want (plus, if the git server on your remote machine \nwere down, it would fall back to ssh automatically for you).\n\nActually, I think this would be a relatively easy project now, if you want \nto attempt it, since fetch and push and both in C now and the config file \nparser in remote.h reports all URLs in the config file's order. You'd just \nneed to make it silently skip URLs in push that don't support pushing, and \nonly give an error if none remain. (And add fallback support to fetch, for \ncompleteness; it's currently only using the first, IIRC).\n\n\t-Daniel\n*This .sig left intentionally blank*\n"}]}