git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "tionis" <out@tionis.dev>
To: "Junio C Hamano" <gitster@pobox.com>
Cc: <git@vger.kernel.org>
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 https://tasadar.net/tionis/test.git /root/test
WORKDIR /root/test
RUN git remote add other-test https://tasadar.net/tionis/other-test.git
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 user.email "person@example.com"
RUN git config --global user.name "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
using: 
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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=COUP3909LNS6.YZG9S8YIV3SQ@tempest \
    --to=out@tionis.dev \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

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