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

Re: git push bug?

From
JTJoakim Tjernlund <joakim.tjernlund@transmode.se>
Date
Oct 18, 2007, 16:01 UTC
Message-ID
<1192723269.9433.21.camel@gentoo-jocke.transmode.se>
In-Reply-To
<0DAC53EF-021D-441C-9520-9795AAB6DE54@zib.de>
On Thu, 2007-10-18 at 17:14 +0200, Steffen Prohaska wrote:
Show 24 quoted lines
> On Oct 18, 2007, at 4:50 PM, Joakim Tjernlund wrote:
> 
> >
> > I thougth I could create a new branch on the server using:
> >
> > # > git push ssh://devsrv/var/git/os2kernel.git linus:refs/linus
> > Warning: No xauth data; using fake authentication data for X11  
> > forwarding.
> > updating 'refs/linus' using 'refs/heads/linus'
> >  from 0000000000000000000000000000000000000000
> >  to bbf25010f1a6b761914430f5fca081ec8c7accd1
> > Generating pack...
> > Done counting 0 objects.
> > Writing 0 objects...
> > Total 0 (delta 0), reused 0 (delta 0)
> > error: refusing to create funny ref 'refs/linus' locally
> > ng refs/linus funny refname
> > error: failed to push to 'ssh://devsrv/var/git/os2kernel.git'
> >
> > but that doesn't work. Am I doing this wrong?
> 
> Include 'heads' in your remote refspec:
> 
>     git push ssh://devsrv/var/git/os2kernel.git linus:refs/heads/linus
Now the push went OK:
git push  ssh://devsrv/var/git/os2kernel.git linus:refs/head/linus
Warning: No xauth data; using fake authentication data for X11 forwarding.
updating 'refs/head/linus' using 'refs/heads/linus'
  from 0000000000000000000000000000000000000000
  to   bbf25010f1a6b761914430f5fca081ec8c7accd1
Generating pack...
Done counting 0 objects.
Writing 0 objects...
Total 0 (delta 0), reused 0 (delta 0)
refs/head/linus: 0000000000000000000000000000000000000000 -> bbf25010f1a6b761914430f5fca081ec8c7accd1
but there is no linus branch in the server repo!
However:
 git push  ssh://devsrv/var/git/os2kernel.git linus
creates a linus branch in the server and 
 git push  ssh://devsrv/var/git/os2kernel.git :linus
 Warning: No xauth data; using fake authentication data for X11 forwarding. 
 deleting 'refs/heads/linus'
 refs/heads/linus: bbf25010f1a6b761914430f5fca081ec8c7accd1 -> deleted
 Everything up-to-date

deletes the linus branch on the server and so does git push ssh://devsrv/var/git/os2kernel.git :refs/heads/linus

ahh, now I see. When creating the branch the refspec needs to be refs/heads/linus, not refs/head/linus

refs/head/linus will create just that on the server. git branch does not look there, only in refs/heads

Seems like it is a bit too easy to make mistakes here. Why can I delete a branch with :linus but not create one with linus:linus? Also confusing that git lets me create refs/head/linus when git branch cannot find it.

 Jocke
Show 12 quoted lines
> You may need to cleanup though. I'm not sure if the remote side
> already created 'refs/linus'. The error message only indicates that
> locally git refused to create the "funny refname". Pushing a refspec
> with an empty local part should delete the "funny refname" on the
> remote:
> 
>     git push ssh://devsrv/var/git/os2kernel.git :refs/linus
> 
> Did this solve your problem?
> 
> 	Steffen
> 
Previous: Steffen ProhaskaNext: Joakim Tjernlund
Message 3 of 21 in “git push bug?”
  1. Joakim TjernlundOct 18, 2007
  2. Steffen ProhaskaOct 18, 2007
  3. Joakim TjernlundOct 18, 2007
  4. Joakim TjernlundOct 18, 2007
  5. Shawn O. PearceOct 19, 2007
  6. Steffen ProhaskaOct 18, 2007
  7. Johannes SchindelinOct 18, 2007
  8. Joakim TjernlundOct 18, 2007
  9. Johannes SchindelinOct 18, 2007
  10. Joakim TjernlundOct 19, 2007
  11. Johannes SchindelinOct 19, 2007
  12. Joakim TjernlundOct 19, 2007
  13. Johannes SchindelinOct 19, 2007
  14. Jan HudecOct 20, 2007
  15. Steffen ProhaskaOct 18, 2007
  16. Johannes SchindelinOct 18, 2007
  17. Steffen ProhaskaOct 20, 2007
  18. Steffen ProhaskaOct 20, 2007
  19. Joakim TjernlundOct 20, 2007
  20. Shawn O. PearceOct 19, 2007
  21. Joakim TjernlundOct 20, 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.