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

Re: Problem with a push

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 11, 2007, 23:03 UTC
Message-ID
<alpine.LFD.0.98.0706111556160.14121@woody.linux-foundation.org>
In-Reply-To
<Pine.LNX.4.64.0706111632050.4406@www.mintpixels.com>
On Mon, 11 Jun 2007, Alex R.M. Turner wrote:
Show 12 quoted lines
> 
> I get the following error when pushing after a merge:
> 
> updating 'refs/heads/master'
>   from c18f9e4350c26e6b45d0a282ff32991784becbdd
>   to   39b7d927720c9f2810e0af5311975119c0d7c7bd
> updating 'refs/remotes/origin/HEAD'
>   from 1e631edb3078ec3a4d1fa598c8f410f6a61659b0
>   to   c18f9e4350c26e6b45d0a282ff32991784becbdd
> updating 'refs/remotes/origin/master'
>   from 1e631edb3078ec3a4d1fa598c8f410f6a61659b0
>   to   c18f9e4350c26e6b45d0a282ff32991784becbdd

Ok, pushing out remote branches is a bit odd in the first place. As in "you probably shouldn't do that". The "remote" branches are really local to each repo, and updating them by pushing is really quite suspect.

So the regular "master" branch pushed out fine:
> refs/heads/master: c18f9e4350c26e6b45d0a282ff32991784becbdd -> 39b7d927720c9f2810e0af5311975119c0d7c7bd
and that part is all ok.
However, I think the problem is this:
> refs/remotes/origin/HEAD: 1e631edb3078ec3a4d1fa598c8f410f6a61659b0 ->  c18f9e4350c26e6b45d0a282ff32991784becbdd

You updated the HEAD file, but that actually is a _symbolic_ ref, which normally points to refs/removes/origin/HEAD, and that in turn explains the other errors:

> ng refs/remotes/origin/master failed to lock
> error: Ref refs/remotes/origin/master is at c18f9e4350c26e6b45d0a282ff32991784becbdd but expected 1e631edb3078ec3a4d1fa598c8f410f6a61659b0
> error: failed to lock refs/remotes/origin/master
> error: failed to push to 'ssh://aturner@svn.mintpixels.com/data/git/mls'

What happened is that the "remotes/origin/master" branch already got updated when you updated HEAD, so now git is complaining that you are trying to update it again, but it no longer has the same value that it had originally (since you changed it).

> but when I try it again, it just says Everything up-to-date.

Right. Because the HEAD update really already did all the changes (to _both_ remotes/origin/HEAD _and_ remotes/origin/master, since it was a symref), so next time around there is nothing to push, and you won't see this issue any more.

So I don't think there was anything reall bad going on, except for the fact that you really shouldn't try to push out remote branches.

What was the command line? In particular, was this a "git push --all" or something? I think we should make sure that we do *not* push remotes by default (and if you really *really* want to push remotes, you'd have to specify them explicitly).

			Linus
Previous: Alex R.M. TurnerNext: Alex R.M. Turner
Message 2 of 15 in “Problem with a push”
  1. Alex R.M. TurnerJun 11, 2007
  2. Linus TorvaldsJun 11, 2007
  3. Alex R.M. TurnerJun 11, 2007
  4. Linus TorvaldsJun 12, 2007
  5. Junio C HamanoJun 12, 2007
  6. Alex R.M. TurnerJun 12, 2007
  7. Linus TorvaldsJun 12, 2007
  8. Jon LoeligerJun 12, 2007
  9. Junio C HamanoJun 11, 2007
  10. Andy ParkinsJun 12, 2007
  11. Linus TorvaldsJun 12, 2007
  12. Junio C HamanoJun 12, 2007
  13. Linus TorvaldsJun 12, 2007
  14. Martin LanghoffJun 12, 2007
  15. "git-push $URL" without refspecs pushes only matching branchesJunio C Hamano, Jul 2, 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.