git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* "remote end hung up unexpectedly"
@ 2007-12-10 11:49 Clifford Heath
  2007-12-10 13:11 ` Andreas Ericsson
  0 siblings, 1 reply; 4+ messages in thread
From: Clifford Heath @ 2007-12-10 11:49 UTC (permalink / raw
  To: git

Be patient with me, it's my first day on git... I like it better than  
svn already,
but I need a bit of help.

After cloning a remote repository, I wanted to update (rebase) an  
existing
remote branch to get the latest master commits, so I switched to it  
using
git checkout, then did a "git merge origin/master" and it updated my  
local
copy so it looked reasonable... I have changes to add to this branch,  
but
I wanted a proper base, so I did a "git commit" and a "git push". The  
push
gave me the above message.

I've checked ssh access (don't have shell) to the other side, my PK  
is set up.

What went wrong? How can I diagnose it further (-v doesn't help)

I understand that to add my further changes, I should set up a local  
branch
to track this updated remote branch. But I'm assuming that the rebase  
must
be done while switched to the remote branch...?

Clifford Heath.

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

* Re: "remote end hung up unexpectedly"
  2007-12-10 11:49 "remote end hung up unexpectedly" Clifford Heath
@ 2007-12-10 13:11 ` Andreas Ericsson
       [not found]   ` <5F13DCA7-5072-4D76-89A7-7F05A5928FA2@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Ericsson @ 2007-12-10 13:11 UTC (permalink / raw
  To: Clifford Heath; +Cc: git

Clifford Heath wrote:
> Be patient with me, it's my first day on git... I like it better than 
> svn already,

Welcome to a better world.

> but I need a bit of help.
> 
> After cloning a remote repository, I wanted to update (rebase) an existing
> remote branch to get the latest master commits, so I switched to it using
> git checkout, then did a "git merge origin/master" and it updated my local
> copy so it looked reasonable... I have changes to add to this branch, but
> I wanted a proper base, so I did a "git commit" and a "git push". The push
> gave me the above message.
> 
> I've checked ssh access (don't have shell) to the other side, my PK is 
> set up.
> 
> What went wrong? How can I diagnose it further (-v doesn't help)
> 

How did you clone it? If you cloned via git:// protocol, you most likely
can't push back there. The git-daemon supports pushing, but does no
authentication.

If you cloned via ssh it's a bit harder to diagnose, since all git knows
is that the ssh-server closed its connection. For security reasons, it
doesn't necessarily tell you why it did that, so it's hard to know what
the real problem is.

> I understand that to add my further changes, I should set up a local branch
> to track this updated remote branch. But I'm assuming that the rebase must
> be done while switched to the remote branch...?
> 

Not really. You can do "git rebase --onto origin/master master". However,
since you merged origin/master earlier, a rebase will only tell you that
you're up-to-date.

"git help rebase" might be worth looking into though.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

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

* Re: "remote end hung up unexpectedly"
       [not found]   ` <5F13DCA7-5072-4D76-89A7-7F05A5928FA2@gmail.com>
@ 2007-12-11  6:54     ` Andreas Ericsson
  2007-12-11  7:15       ` Clifford Heath
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Ericsson @ 2007-12-11  6:54 UTC (permalink / raw
  To: Clifford Heath, Git Mailing List

I'm bringing this back on the list. It's very uncharitable of you to not
do so yourself, as it prevents others with the same problem to find the
answer in the archives. Also, I don't run a private support-center for
git, so emailing me privately with questions regarding it is just plain
rude. Everyone's entitled to a second chance though, so read on below.

Clifford Heath wrote:
> On 11/12/2007, at 12:11 AM, Andreas Ericsson wrote:
>> How did you clone it? If you cloned via git:// protocol, you most likely
>> can't push back there. The git-daemon supports pushing, but does no
>> authentication.
> 
> That was a problem - shame git didn't say "connection refused" instead,
> that would have been more obvious. The manpages are loaded with
> git-specific jargon - almost impenetrable for a newbie.
> 

Git doesn't see that. It only knows it didn't get a proper response from
the other end.

> 
>> Not really. You can do "git rebase --onto origin/master master". However,
>> since you merged origin/master earlier, a rebase will only tell you that
>> you're up-to-date.
> 
> I don't think that anything I've done has affected the remote repository.


It hasn't. The only way you can update the remote repository, short of
editing it manually, is to use "git push". That's not strictly true, but
for the sake of this argument, it will suffice.


> At least, no changes are visible in the web view.
> 

You can merge between local branches and still get the "up-to-date" message.


> Most of the instructions and manpages I've read show how to do things
> to local repositories and push changes back. Here's what I most recently
> tried, perhaps you can see where I went wrong. I've changed the project
> name for PROJECT, and the branch name with BRANCH
> 
> git clone git+ssh://cjheath@repo.or.cz/srv/git/PROJECT.git
> cd PROJECT
> git checkout --track -b BRANCH origin/BRANCH
> git rebase origin/master
> 
> At this point the local branch seems to have the content I want, so I tried
> to push the changes back in:
> 

You mean, "at this point BRANCH seems to have the content I want"?

> git push
> 
> Which replied:
> 
> error: remote 'refs/heads/BRANCH' is not a strict subset of local ref 
> 'refs/heads/BRANCH'. maybe you are not up-to-date and need to pull first?
> error: failed to push to 'git+ssh://cjheath@repo.or.cz/srv/git/PROJECT.git'
> 

Yes. What you did caused history to be rewritten. Push is fast-forward[1]
only by default, to prevent published history from being modified, so when
you moved one line of development onto another you effectively changed its
ancestry.

If you do

git checkout BRANCH
git reset --hard origin/BRANCH
git merge origin/master
git push

you will achieve the desired end-result. If you really, really want a linear
history, you can do

git push -f origin BRANCH

but beware that this will cause errors for everyone fetching from you, and
for yourself if you fetch into multiple local clones of the same remote.

I suggest you sit down and really read through the git rebase man-page to
understand what it does and the precautions one must take when rewriting
history like that.


[1]fast-forward:
    A fast-forward is a special type of merge where you have a
    revision and you are "merging" another branch's changes that
    happen to be a descendant of what you have. In such cases,
    you do not make a new merge commit but instead just update
    to his revision. This will happen frequently on a tracking
    of a remote repository.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

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

* Re: "remote end hung up unexpectedly"
  2007-12-11  6:54     ` Andreas Ericsson
@ 2007-12-11  7:15       ` Clifford Heath
  0 siblings, 0 replies; 4+ messages in thread
From: Clifford Heath @ 2007-12-11  7:15 UTC (permalink / raw
  To: Andreas Ericsson; +Cc: Git Mailing List

On 11/12/2007, at 5:54 PM, Andreas Ericsson wrote:
> I'm bringing this back on the list. It's very uncharitable of you  
> to not
> do so yourself,

My humble apologies - I just hit reply. I've previously only encountered
majordomo configurations where the reply goes to the list (including
when I operated majordomo for ten years), so I made a mistake.

>>> Not really. You can do "git rebase --onto origin/master master".  
>>> However,
>>> since you merged origin/master earlier, a rebase will only tell  
>>> you that
>>> you're up-to-date.
>> I don't think that anything I've done has affected the remote  
>> repository.
>
> It hasn't. The only way you can update the remote repository, short of
> editing it manually, is to use "git push". That's not strictly  
> true, but
> for the sake of this argument, it will suffice.

Thanks, that's good confirmation.

>> Most of the instructions and manpages I've read show how to do things
>> to local repositories and push changes back. Here's what I most  
>> recently
>> tried, perhaps you can see where I went wrong. I've changed the  
>> project
>> name for PROJECT, and the branch name with BRANCH
>> git clone git+ssh://cjheath@repo.or.cz/srv/git/PROJECT.git
>> cd PROJECT
>> git checkout --track -b BRANCH origin/BRANCH
>> git rebase origin/master
>> At this point the local branch seems to have the content I want,  
>> so I tried
>> to push the changes back in:
>
> You mean, "at this point BRANCH seems to have the content I want"?

No, I mean that the recent changes have been pulled from origin/master
and my tree looks like what I want the remote origin/BRANCH to look  
like.
Though if I pushed, I don't know that its revision history would  
necessarily
be in the preferred order.

>> git push
>> Which replied:
>> error: remote 'refs/heads/BRANCH' is not a strict subset of local  
>> ref 'refs/heads/BRANCH'. maybe you are not up-to-date and need to  
>> pull first?
>> error: failed to push to 'git+ssh://cjheath@repo.or.cz/srv/git/ 
>> PROJECT.git'
>
> Yes. What you did caused history to be rewritten. Push is fast- 
> forward[1]
> only by default, to prevent published history from being modified,  
> so when
> you moved one line of development onto another you effectively  
> changed its
> ancestry.

Ok, I think I follow that. I can see I need to spend more time  
reading the
man pages.  Thanks for your help...

Clifford Heath.

> If you do
>
> git checkout BRANCH
> git reset --hard origin/BRANCH
> git merge origin/master
> git push
>
> you will achieve the desired end-result. If you really, really want  
> a linear
> history, you can do
>
> git push -f origin BRANCH
>
> but beware that this will cause errors for everyone fetching from  
> you, and
> for yourself if you fetch into multiple local clones of the same  
> remote.
>
> I suggest you sit down and really read through the git rebase man- 
> page to
> understand what it does and the precautions one must take when  
> rewriting
> history like that.
>
>
> [1]fast-forward:
>    A fast-forward is a special type of merge where you have a
>    revision and you are "merging" another branch's changes that
>    happen to be a descendant of what you have. In such cases,
>    you do not make a new merge commit but instead just update
>    to his revision. This will happen frequently on a tracking
>    of a remote repository.
>
> -- 
> Andreas Ericsson                   andreas.ericsson@op5.se
> OP5 AB                             www.op5.se
> Tel: +46 8-230225                  Fax: +46 8-230231

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

end of thread, other threads:[~2007-12-11  7:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-10 11:49 "remote end hung up unexpectedly" Clifford Heath
2007-12-10 13:11 ` Andreas Ericsson
     [not found]   ` <5F13DCA7-5072-4D76-89A7-7F05A5928FA2@gmail.com>
2007-12-11  6:54     ` Andreas Ericsson
2007-12-11  7:15       ` Clifford Heath

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).