> On Sun, Apr 16, 2023 at 2:31 PM Uwe Brauer <o...@mat.ucm.es> wrote:


> You cannot push a branch you don't have. Obviously.

> But you can create the branches without checking them out, as I
> already explained:

>   git for-each-ref --format='git switch %(refname:lstrip=3)' 
> refs/remotes/origin

> Or you can push the commit of a remote branch:

>   git push hg-remote remotes/origin/modernize:modernize

> It's not clear what would be the best thing to do here because you
> haven't explained your use-case.

Here is what I do



* Step by step

    1) git clone g...@gitlab.com:kalthad/matlab-emacs-default.git
    2) mkdir mercurial-emacs-default
    3) cd mercurial-emacs-default
    4) hg init
    5) cd ../matlab-emacs-default
    6) git remote add hg-remote hg::../mercurial-matlab-emacs-default/
    7) git for-each-ref --format='git switch %(refname:lstrip=3)' 
refs/remotes/origin
    8) git config remote.hg-remote.push 'refs/heads/*:refs/heads/branches/*'
    9) git branch -a
    10) git push hg-remote default  (works)
    11) git push hg-remote remotes/origin/modernize:modernize


#+begin_src 

error: The destination you provided is not a full refname (i.e.,
starting with "refs/"). We tried to guess what you meant by:

- Looking for a ref that matches 'modernize' on the remote side.
- Checking if the <src> being pushed ('refs/remotes/origin/modernize')
  is a ref in "refs/{heads,tags}/". If so we add a corresponding
  refs/{heads,tags}/ prefix on the remote side.

Neither worked, so we gave up. You must fully qualify the ref.
hint: The <src> part of the refspec is a commit object.
hint: Did you mean to create a new branch by pushing to
hint: 'refs/remotes/origin/modernize:refs/heads/modernize'?
error: failed to push some refs to 
'hg::/home/oub/Push-test/mercurial-matlab-emacs-default'
#+end_src



-- 
Warning: Content may be disturbing to some audiences
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 
https://addons.thunderbird.net/en-US/thunderbird/addon/gmail-conversation-view/

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/87cz42u87s.fsf_-_%40mat.ucm.es.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to