git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git push refspec problem
@ 2007-11-07 15:01 James
  2007-11-07 15:11 ` Johannes Schindelin
  0 siblings, 1 reply; 10+ messages in thread
From: James @ 2007-11-07 15:01 UTC (permalink / raw)
  To: git

Hi,

I'm trying to set up my git configuration file in one of my projects  
so that I can do a simple "git push" to update my project on the git  
server.

Currently, I run the following command to push my updates (and it  
works just fine):

git push james@my.server.com:~/scm/git/project.git/

In my .git/config file, I've added a line for push, as follows:

[remote "origin"]
         url = git://my.server.com/project.git
         fetch = +refs/heads/*:refs/remotes/origin/*
         push = ssh://james@my.server.com/home/james/scm/git/ 
project.git/

When I run a "git push", it comes back with this error:

fatal: remote part of refspec is not a valid name in ssh://james@my.server.com/home/james/scm/git/project.git/

I've looked at this git push documentation:

http://www.kernel.org/pub/software/scm/git/docs/git-push.html

and it seems like my refspec is indeed correct.  (or so I thought ;))   
Any ideas on what I'm doing wrong?

Thanks!
.james

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:01 git push refspec problem James
@ 2007-11-07 15:11 ` Johannes Schindelin
  2007-11-07 15:20   ` Pierre Habouzit
  2007-11-07 15:22   ` Johannes Gilger
  0 siblings, 2 replies; 10+ messages in thread
From: Johannes Schindelin @ 2007-11-07 15:11 UTC (permalink / raw)
  To: James; +Cc: git

Hi,

On Wed, 7 Nov 2007, James wrote:

>        fetch = +refs/heads/*:refs/remotes/origin/*

This is a refspec.

>        push = ssh://james@my.server.com/home/james/scm/git/project.git/

This is a URL.  It does not specify any refs.  But "push =" expects a URL.

You probably want to setup a different remote if you want to push to a 
different URL than you are fetching from.

Hth,
Dscho

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:11 ` Johannes Schindelin
@ 2007-11-07 15:20   ` Pierre Habouzit
  2007-11-07 15:23     ` James
  2007-11-07 15:22   ` Johannes Gilger
  1 sibling, 1 reply; 10+ messages in thread
From: Pierre Habouzit @ 2007-11-07 15:20 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: James, git

[-- Attachment #1: Type: text/plain, Size: 853 bytes --]

On Wed, Nov 07, 2007 at 03:11:46PM +0000, Johannes Schindelin wrote:
> Hi,
> 
> On Wed, 7 Nov 2007, James wrote:
> 
> >        fetch = +refs/heads/*:refs/remotes/origin/*
> 
> This is a refspec.
> 
> >        push = ssh://james@my.server.com/home/james/scm/git/project.git/
> 
> This is a URL.  It does not specify any refs.  But "push =" expects a URL.
> 
> You probably want to setup a different remote if you want to push to a 
> different URL than you are fetching from.

  Oh, there is no way to pull through git:// and push to ssh://
perfectly knowint it's the same physical repository so that the fetch
doesn't have the ssh-handhshake-overhead ?


-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:11 ` Johannes Schindelin
  2007-11-07 15:20   ` Pierre Habouzit
@ 2007-11-07 15:22   ` Johannes Gilger
  2007-11-07 15:30     ` James
  2007-11-07 15:39     ` Johannes Schindelin
  1 sibling, 2 replies; 10+ messages in thread
From: Johannes Gilger @ 2007-11-07 15:22 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: James, git

Johannes Schindelin wrote:
> Hi,
> 
> On Wed, 7 Nov 2007, James wrote:
> 
>>        fetch = +refs/heads/*:refs/remotes/origin/*
> 
> This is a refspec.
> 
>>        push = ssh://james@my.server.com/home/james/scm/git/project.git/
> 
> This is a URL.  It does not specify any refs.  But "push =" expects a URL.

I think Johannes meant to say "But 'push =' expects a refspec." (the
manpage even says so).

About your problem: If you want to pull from a git:// repository and
push to another with ssh:// (or in general when having two different
repositories for pushing and fetching) in my novice understanding
you would need two remotes. In your case, can't you just use your
ssh-url for fetching as well?

Regards,
Jojo

-- 
Johannes Gilger <heipei@hackvalue.de>
http://hackvalue.de/heipei/
GPG-Key: 0x42F6DE81
GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:20   ` Pierre Habouzit
@ 2007-11-07 15:23     ` James
  2007-11-07 15:26       ` Johannes Gilger
  0 siblings, 1 reply; 10+ messages in thread
From: James @ 2007-11-07 15:23 UTC (permalink / raw)
  To: Pierre Habouzit; +Cc: Johannes Schindelin, git

On Nov 7, 2007, at 10:20 AM, Pierre Habouzit wrote:

> On Wed, Nov 07, 2007 at 03:11:46PM +0000, Johannes Schindelin wrote:
>> Hi,
>>
>> On Wed, 7 Nov 2007, James wrote:
>>
>>>       fetch = +refs/heads/*:refs/remotes/origin/*
>>
>> This is a refspec.
>>
>>>       push = ssh://james@my.server.com/home/james/scm/git/project.git/
>>
>> This is a URL.  It does not specify any refs.  But "push =" expects  
>> a URL.
>>
>> You probably want to setup a different remote if you want to push  
>> to a
>> different URL than you are fetching from.
>
>  Oh, there is no way to pull through git:// and push to ssh://
> perfectly knowint it's the same physical repository so that the fetch
> doesn't have the ssh-handhshake-overhead ?


There has to be *some* way of pulling through git and pushing through  
ssh with a simple "git push".  :-P  I'm doing it manually, after all.   
I could have sworn I've read how to do its somewhere but have since  
forgotten.


> -- 
> ·O·  Pierre Habouzit
> ··O                                                madcoder@debian.org
> OOO                                                http://www.madism.org

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:23     ` James
@ 2007-11-07 15:26       ` Johannes Gilger
  2007-11-07 15:38         ` Pierre Habouzit
  0 siblings, 1 reply; 10+ messages in thread
From: Johannes Gilger @ 2007-11-07 15:26 UTC (permalink / raw)
  To: James; +Cc: Pierre Habouzit, Johannes Schindelin, git

James wrote:
> There has to be *some* way of pulling through git and pushing through
> ssh with a simple "git push".  :-P  I'm doing it manually, after all.  I
> could have sworn I've read how to do its somewhere but have since
> forgotten.

Would two remotes do the trick? One remote only has a fetch entry
while the other one has a push entry.

Regards,
Jojo

-- 
Johannes Gilger <heipei@hackvalue.de>
http://hackvalue.de/heipei/
GPG-Key: 0x42F6DE81
GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:22   ` Johannes Gilger
@ 2007-11-07 15:30     ` James
  2007-11-07 20:40       ` Daniel Barkalow
  2007-11-07 15:39     ` Johannes Schindelin
  1 sibling, 1 reply; 10+ messages in thread
From: James @ 2007-11-07 15:30 UTC (permalink / raw)
  To: Johannes Gilger; +Cc: Johannes Schindelin, git


On Nov 7, 2007, at 10:22 AM, Johannes Gilger wrote:

> Johannes Schindelin wrote:
>> Hi,
>>
>> On Wed, 7 Nov 2007, James wrote:
>>
>>>       fetch = +refs/heads/*:refs/remotes/origin/*
>>
>> This is a refspec.
>>
>>>       push = ssh://james@my.server.com/home/james/scm/git/project.git/
>>
>> This is a URL.  It does not specify any refs.  But "push =" expects  
>> a URL.
>
> I think Johannes meant to say "But 'push =' expects a refspec." (the
> manpage even says so).
>
> About your problem: If you want to pull from a git:// repository and
> push to another with ssh:// (or in general when having two different
> repositories for pushing and fetching) in my novice understanding
> you would need two remotes. In your case, can't you just use your
> ssh-url for fetching as well?
>
> Regards,
> Jojo


I guess I could use my ssh url for pulling, as well.  I simply figured  
it would be easier to add an ssh URL for push (like I was doing  
manually) and be done with it.  But it doesn't seem there's a super  
simple solution (i.e., my syntax was wrong in the config file) to  
using git for pull and ssh for push.

.james


> -- 
> Johannes Gilger <heipei@hackvalue.de>
> http://hackvalue.de/heipei/
> GPG-Key: 0x42F6DE81
> GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:26       ` Johannes Gilger
@ 2007-11-07 15:38         ` Pierre Habouzit
  0 siblings, 0 replies; 10+ messages in thread
From: Pierre Habouzit @ 2007-11-07 15:38 UTC (permalink / raw)
  To: Johannes Gilger; +Cc: James, Johannes Schindelin, git

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

On Wed, Nov 07, 2007 at 03:26:16PM +0000, Johannes Gilger wrote:
> James wrote:
> > There has to be *some* way of pulling through git and pushing through
> > ssh with a simple "git push".  :-P  I'm doing it manually, after all.  I
> > could have sworn I've read how to do its somewhere but have since
> > forgotten.
> 
> Would two remotes do the trick? One remote only has a fetch entry
> while the other one has a push entry.

  Yes you can do that, but that means you have to spell out the remote
name either for fetching or pushing which somehow sucks :)


-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:22   ` Johannes Gilger
  2007-11-07 15:30     ` James
@ 2007-11-07 15:39     ` Johannes Schindelin
  1 sibling, 0 replies; 10+ messages in thread
From: Johannes Schindelin @ 2007-11-07 15:39 UTC (permalink / raw)
  To: Johannes Gilger; +Cc: James, git

Hi,

On Wed, 7 Nov 2007, Johannes Gilger wrote:

> Johannes Schindelin wrote:
> 
> > On Wed, 7 Nov 2007, James wrote:
> > 
> >>        fetch = +refs/heads/*:refs/remotes/origin/*
> > 
> > This is a refspec.
> > 
> >>        push = ssh://james@my.server.com/home/james/scm/git/project.git/
> > 
> > This is a URL.  It does not specify any refs.  But "push =" expects a 
> > URL.
> 
> I think Johannes meant to say "But 'push =' expects a refspec." (the 
> manpage even says so).

Of course.  Thanks.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: git push refspec problem
  2007-11-07 15:30     ` James
@ 2007-11-07 20:40       ` Daniel Barkalow
  0 siblings, 0 replies; 10+ messages in thread
From: Daniel Barkalow @ 2007-11-07 20:40 UTC (permalink / raw)
  To: James; +Cc: Johannes Gilger, Johannes Schindelin, git

On Wed, 7 Nov 2007, James wrote:

> On Nov 7, 2007, at 10:22 AM, Johannes Gilger wrote:
> 
> >Johannes Schindelin wrote:
> > >Hi,
> > >
> > >On Wed, 7 Nov 2007, James wrote:
> > >
> > > >      fetch = +refs/heads/*:refs/remotes/origin/*
> > >
> > >This is a refspec.
> > >
> > > >      push = ssh://james@my.server.com/home/james/scm/git/project.git/
> > >
> > >This is a URL.  It does not specify any refs.  But "push =" expects a URL.
> >
> >I think Johannes meant to say "But 'push =' expects a refspec." (the
> >manpage even says so).
> >
> >About your problem: If you want to pull from a git:// repository and
> >push to another with ssh:// (or in general when having two different
> >repositories for pushing and fetching) in my novice understanding
> >you would need two remotes. In your case, can't you just use your
> >ssh-url for fetching as well?
> >
> >Regards,
> >Jojo
> 
> 
> I guess I could use my ssh url for pulling, as well.  I simply figured it
> would be easier to add an ssh URL for push (like I was doing manually) and be
> done with it.  But it doesn't seem there's a super simple solution (i.e., my
> syntax was wrong in the config file) to using git for pull and ssh for push.

We *should* be able to make the rules: fetch tries URLs until one works, 
and then ignores later ones; push uses, in turn, all URLs that support 
pushing.

Then you could just list both URLs, with the "git:" one first, and it 
would do what you want (plus, if the git server on your remote machine 
were down, it would fall back to ssh automatically for you).

Actually, I think this would be a relatively easy project now, if you want 
to attempt it, since fetch and push and both in C now and the config file 
parser in remote.h reports all URLs in the config file's order. You'd just 
need to make it silently skip URLs in push that don't support pushing, and 
only give an error if none remain. (And add fallback support to fetch, for 
completeness; it's currently only using the first, IIRC).

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-11-07 20:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07 15:01 git push refspec problem James
2007-11-07 15:11 ` Johannes Schindelin
2007-11-07 15:20   ` Pierre Habouzit
2007-11-07 15:23     ` James
2007-11-07 15:26       ` Johannes Gilger
2007-11-07 15:38         ` Pierre Habouzit
2007-11-07 15:22   ` Johannes Gilger
2007-11-07 15:30     ` James
2007-11-07 20:40       ` Daniel Barkalow
2007-11-07 15:39     ` Johannes Schindelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).