mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "tionis" <>
To: "Junio C Hamano" <>
Cc: <>
Subject: Re: bug report: git push fails in worktree
Date: Tue, 06 Dec 2022 12:23:49 +0100	[thread overview]
Message-ID: <COUP3909LNS6.YZG9S8YIV3SQ@tempest> (raw)
In-Reply-To: <xmqqr0xdnw88.fsf@gitster.g>

Sorry, you're right I totally forgot some steps. 
I tried to reproduce the error in a Docker Container using the
Dockerfile below:

FROM alpine:latest
RUN apk add git
RUN git clone /root/test
WORKDIR /root/test
RUN git remote add other-test
RUN git fetch other-test main:other-test
RUN git branch --set-upstream-to=other-test/main other-test
RUN git worktree add /root/other-test other-test
WORKDIR /root/other-test
RUN touch this-is-a-test-file
RUN git config --global ""
RUN git config --global "Name"
RUN git add .
RUN git commit -m "commit this-is-a-test-file"
CMD ["sh"]

This time git showed me following error message when trying to push:

fatal: The upstream branch of your current branch does not match
the name of your current branch.  To push to the upstream branch
on the remote, use

    git push other-test HEAD:main

To push to the branch of the same name on the remote, use

    git push other-test HEAD

To choose either option permanently, see push.default in 'git help config'.

Following this reference I could resolve my issue by changing the config
git config push.default upstream

I'm sorry to have wasted your time with this and wish you a nice day.

      reply	other threads:[~2022-12-06 11:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-06  1:03 bug report: git push fails in worktree tionis
2022-12-06  1:42 ` Junio C Hamano
2022-12-06 11:23   ` tionis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=COUP3909LNS6.YZG9S8YIV3SQ@tempest \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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).