* Simple git push --tags deleted all branches @ 2018-11-28 16:50 Mateusz Loskot 2018-11-28 18:13 ` Mateusz Loskot 2018-11-29 15:03 ` Ævar Arnfjörð Bjarmason 0 siblings, 2 replies; 6+ messages in thread From: Mateusz Loskot @ 2018-11-28 16:50 UTC (permalink / raw) To: git Hi, (using git version 2.19.2.windows.1) I've just encountered one of those WTH moments. I have a bare repository core.git (BARE:master) $ git branch 1.0 2.0 * master core.git (BARE:master) $ git tag 1.0.1651 1.0.766 2.0.1103 2.0.1200 I published the repo using: git push --all --follow-tags This succeeded, but there seem to be no tags pushed, just branches. So, I followed with core.git (BARE:master) $ git push --tags To XXX - [deleted] 1.0 - [deleted] 2.0 ! [remote rejected] master (refusing to delete the current branch: refs/heads/master) error: failed to push some refs to 'XXX' And, I've found out that all branches and tags have been wiped in both, local repo and remote :) I restored the repo and tried out git push origin 1.0 git push origin --tags and this time both succeeded, without wiping out any refs. Could anyone help me to understand why remote-less git push --tags is/was so dangerous and unforgiving?! Best regards, -- Mateusz Loskot, http://mateusz.loskot.net ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple git push --tags deleted all branches 2018-11-28 16:50 Simple git push --tags deleted all branches Mateusz Loskot @ 2018-11-28 18:13 ` Mateusz Loskot 2018-11-29 15:03 ` Ævar Arnfjörð Bjarmason 1 sibling, 0 replies; 6+ messages in thread From: Mateusz Loskot @ 2018-11-28 18:13 UTC (permalink / raw) To: git On Wed, 28 Nov 2018 at 17:50, Mateusz Loskot <mateusz@loskot.net> wrote: > > (using git version 2.19.2.windows.1) > [...] > I restored the repo and tried out > > git push origin 1.0 > git push origin --tags > > and this time both succeeded, without wiping out any refs. And, to my surprise, this pushed all branches and all tags: git push --all origin So, I did not have to run follow with tags push only using git push --tags origin Has anything changes in [1] that now --all Push all branches ...AND tags? [1] https://git-scm.com/docs/git-push#git-push---all Best regards, -- Mateusz Loskot, http://mateusz.loskot.net ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple git push --tags deleted all branches 2018-11-28 16:50 Simple git push --tags deleted all branches Mateusz Loskot 2018-11-28 18:13 ` Mateusz Loskot @ 2018-11-29 15:03 ` Ævar Arnfjörð Bjarmason 2018-11-29 15:18 ` Mateusz Loskot 1 sibling, 1 reply; 6+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2018-11-29 15:03 UTC (permalink / raw) To: Mateusz Loskot; +Cc: git On Wed, Nov 28 2018, Mateusz Loskot wrote: > Hi, > > (using git version 2.19.2.windows.1) > > I've just encountered one of those WTH moments. > > I have a bare repository > > core.git (BARE:master) $ git branch > 1.0 > 2.0 > * master > > core.git (BARE:master) $ git tag > 1.0.1651 > 1.0.766 > 2.0.1103 > 2.0.1200 > > I published the repo using: git push --all --follow-tags > > This succeeded, but there seem to be no tags pushed, just branches. > So, I followed with > > core.git (BARE:master) $ git push --tags > To XXX > - [deleted] 1.0 > - [deleted] 2.0 > ! [remote rejected] master (refusing to delete the current > branch: refs/heads/master) > error: failed to push some refs to 'XXX' > > And, I've found out that all branches and tags have been > wiped in both, local repo and remote :) > > I restored the repo and tried out > > git push origin 1.0 > git push origin --tags > > and this time both succeeded, without wiping out any refs. > > Could anyone help me to understand why remote-less > > git push --tags > > is/was so dangerous and unforgiving?! Since nobody's replied yet, I can't see what's going on here from the info you've provided. My guess is that you have something "mirror" set on the remote. It seems you can't share the repo or its URL, but could you share the scrubbed output of 'git config -l --show-origin' when run inside this repository? ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple git push --tags deleted all branches 2018-11-29 15:03 ` Ævar Arnfjörð Bjarmason @ 2018-11-29 15:18 ` Mateusz Loskot 2018-11-29 15:39 ` Ævar Arnfjörð Bjarmason 0 siblings, 1 reply; 6+ messages in thread From: Mateusz Loskot @ 2018-11-29 15:18 UTC (permalink / raw) To: git On Thu, 29 Nov 2018 at 16:03, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > On Wed, Nov 28 2018, Mateusz Loskot wrote: > > > > (using git version 2.19.2.windows.1) > > > > I've just encountered one of those WTH moments. > > > > I have a bare repository > > > > core.git (BARE:master) $ git branch > > 1.0 > > 2.0 > > * master > > > > core.git (BARE:master) $ git tag > > 1.0.1651 > > 1.0.766 > > 2.0.1103 > > 2.0.1200 > > > > I published the repo using: git push --all --follow-tags > > > > This succeeded, but there seem to be no tags pushed, just branches. > > So, I followed with > > > > core.git (BARE:master) $ git push --tags > > To XXX > > - [deleted] 1.0 > > - [deleted] 2.0 > > ! [remote rejected] master (refusing to delete the current > > branch: refs/heads/master) > > error: failed to push some refs to 'XXX' > > > > And, I've found out that all branches and tags have been > > wiped in both, local repo and remote :) > > > > I restored the repo and tried out > > > > git push origin 1.0 > > git push origin --tags > > > > and this time both succeeded, without wiping out any refs. > > > > Could anyone help me to understand why remote-less > > > > git push --tags > > > > is/was so dangerous and unforgiving?! > > Since nobody's replied yet, I can't see what's going on here from the > info you've provided. My guess is that you have something "mirror" set > on the remote. Thank you for responding. The git push --tags hugely surprised me, and here is genuine screenshot https://twitter.com/mloskot/status/1068072285846859776 > It seems you can't share the repo or its URL, but could you share the > scrubbed output of 'git config -l --show-origin' when run inside this > repository? Here is complete output. I have not stripped the basics like aliases, just in case. ``` core-external-metadata.git (BARE:master) $ git config -l --show-origin file:"C:\\ProgramData/Git/config" core.symlinks=false file:"C:\\ProgramData/Git/config" core.autocrlf=true file:"C:\\ProgramData/Git/config" color.diff=auto file:"C:\\ProgramData/Git/config" color.status=auto file:"C:\\ProgramData/Git/config" color.branch=auto file:"C:\\ProgramData/Git/config" color.interactive=true file:"C:\\ProgramData/Git/config" help.format=html file:"C:\\ProgramData/Git/config" http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt file:"C:\\ProgramData/Git/config" diff.astextplain.textconv=astextplain file:"C:\\ProgramData/Git/config" rebase.autosquash=true file:C:/Program Files/Git/mingw64/etc/gitconfig http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt file:C:/Program Files/Git/mingw64/etc/gitconfig http.sslbackend=openssl file:C:/Program Files/Git/mingw64/etc/gitconfig diff.astextplain.textconv=astextplain file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.process=git-lfs filter-process file:C:/Program Files/Git/mingw64/etc/gitconfig filter.lfs.required=true file:C:/Program Files/Git/mingw64/etc/gitconfig credential.helper=manager file:C:/Users/mateuszl/.gitconfig user.name=Mateusz Łoskot file:C:/Users/mateuszl/.gitconfig user.email=mateusz@loskot.net file:C:/Users/mateuszl/.gitconfig github.user=mloskot file:C:/Users/mateuszl/.gitconfig core.editor=vim file:C:/Users/mateuszl/.gitconfig color.branch=auto file:C:/Users/mateuszl/.gitconfig color.diff=auto file:C:/Users/mateuszl/.gitconfig color.status=auto file:C:/Users/mateuszl/.gitconfig color.ui=auto file:C:/Users/mateuszl/.gitconfig alias.br=branch file:C:/Users/mateuszl/.gitconfig alias.bv=branch -vv file:C:/Users/mateuszl/.gitconfig alias.brv=branch -vv file:C:/Users/mateuszl/.gitconfig alias.bra=branch -a file:C:/Users/mateuszl/.gitconfig alias.ci=commit --verbose file:C:/Users/mateuszl/.gitconfig alias.cia=commit --verbose --amend file:C:/Users/mateuszl/.gitconfig alias.ciae=commit --verbose --amend --no-edit file:C:/Users/mateuszl/.gitconfig alias.co=checkout file:C:/Users/mateuszl/.gitconfig alias.dc=diff --cached file:C:/Users/mateuszl/.gitconfig alias.df=diff file:C:/Users/mateuszl/.gitconfig alias.gf=flow file:C:/Users/mateuszl/.gitconfig alias.lg=log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit file:C:/Users/mateuszl/.gitconfig alias.lol=log --graph --decorate --pretty=oneline --abbrev-commit file:C:/Users/mateuszl/.gitconfig alias.lola=log --graph --decorate --pretty=oneline --abbrev-commit --all file:C:/Users/mateuszl/.gitconfig alias.ls=ls-files file:C:/Users/mateuszl/.gitconfig alias.lst=lfs status file:C:/Users/mateuszl/.gitconfig alias.rt=remote file:C:/Users/mateuszl/.gitconfig alias.rtv=remote -v file:C:/Users/mateuszl/.gitconfig alias.st=status file:C:/Users/mateuszl/.gitconfig alias.ghclm=!sh -c 'git log $1...$2 --pretty=format:"* [view](http://github.com/$3/$4/commit/%H) - %s"' - file:C:/Users/mateuszl/.gitconfig alias.ign=ls-files -o -i --exclude-standard file:C:/Users/mateuszl/.gitconfig alias.prune-branches-origin=!git remote prune origin && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -r git branch -D file:C:/Users/mateuszl/.gitconfig alias.prune-branches-mloskot=!git remote prune mloskot && git branch -vv | grep ': gone]' | awk '{print $1}' | xargs -r git branch -D file:C:/Users/mateuszl/.gitconfig alias.hist=log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short file:C:/Users/mateuszl/.gitconfig commit.template=~/.gitmessage file:C:/Users/mateuszl/.gitconfig credential.helper=manager file:C:/Users/mateuszl/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Users/mateuszl/.gitconfig filter.lfs.smudge=git-lfs smudge --skip -- %f file:C:/Users/mateuszl/.gitconfig filter.lfs.process=git-lfs filter-process --skip file:C:/Users/mateuszl/.gitconfig filter.lfs.required=true file:config core.repositoryformatversion=0 file:config core.filemode=false file:config core.bare=true file:config core.symlinks=false file:config core.ignorecase=true file:config remote.origin.url=https://xxx.com/core-external-metadata.git file:config remote.origin.fetch=+refs/*:refs/* file:config remote.origin.mirror=true file:config lfs.https://xxx.com/core-external-metadata.git/info/lfs.access=basic ``` Best regards, -- Mateusz Loskot, http://mateusz.loskot.net ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple git push --tags deleted all branches 2018-11-29 15:18 ` Mateusz Loskot @ 2018-11-29 15:39 ` Ævar Arnfjörð Bjarmason 2018-12-04 19:00 ` Mateusz Loskot 0 siblings, 1 reply; 6+ messages in thread From: Ævar Arnfjörð Bjarmason @ 2018-11-29 15:39 UTC (permalink / raw) To: Mateusz Loskot; +Cc: git On Thu, Nov 29 2018, Mateusz Loskot wrote: > On Thu, 29 Nov 2018 at 16:03, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: >> On Wed, Nov 28 2018, Mateusz Loskot wrote: >> > >> > (using git version 2.19.2.windows.1) >> > >> > I've just encountered one of those WTH moments. >> > >> > I have a bare repository >> > >> > core.git (BARE:master) $ git branch >> > 1.0 >> > 2.0 >> > * master >> > >> > core.git (BARE:master) $ git tag >> > 1.0.1651 >> > 1.0.766 >> > 2.0.1103 >> > 2.0.1200 >> > >> > I published the repo using: git push --all --follow-tags >> > >> > This succeeded, but there seem to be no tags pushed, just branches. >> > So, I followed with >> > >> > core.git (BARE:master) $ git push --tags >> > To XXX >> > - [deleted] 1.0 >> > - [deleted] 2.0 >> > ! [remote rejected] master (refusing to delete the current >> > branch: refs/heads/master) >> > error: failed to push some refs to 'XXX' >> > >> > And, I've found out that all branches and tags have been >> > wiped in both, local repo and remote :) >> > >> > I restored the repo and tried out >> > >> > git push origin 1.0 >> > git push origin --tags >> > >> > and this time both succeeded, without wiping out any refs. >> > >> > Could anyone help me to understand why remote-less >> > >> > git push --tags >> > >> > is/was so dangerous and unforgiving?! >> >> Since nobody's replied yet, I can't see what's going on here from the >> info you've provided. My guess is that you have something "mirror" set >> on the remote. > > Thank you for responding. > > The git push --tags hugely surprised me, and here is genuine screenshot > https://twitter.com/mloskot/status/1068072285846859776 > >> It seems you can't share the repo or its URL, but could you share the >> scrubbed output of 'git config -l --show-origin' when run inside this >> repository? > > Here is complete output. I have not stripped the basics like aliases, > just in case. Right, it's because you used --mirror, the important bit: > file:config remote.origin.url=https://xxx.com/core-external-metadata.git > file:config remote.origin.fetch=+refs/*:refs/* > file:config remote.origin.mirror=true > file:config I.e. you have cloned with the --mirror flag, this is what it's supposed to do: https://git-scm.com/docs/git-clone#git-clone---mirror https://git-scm.com/docs/git-fetch#git-fetch---prune I.e. you push and git tries to mirror the refs you have locally to the remote, including pruning stuff in the remote. This is useful, but not what you wanted here. It's used for e.g. making an up-to-date copy of a repo from server A to server B in HA setups where you'd like to fail over to server B and get the same refs you had on A. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Simple git push --tags deleted all branches 2018-11-29 15:39 ` Ævar Arnfjörð Bjarmason @ 2018-12-04 19:00 ` Mateusz Loskot 0 siblings, 0 replies; 6+ messages in thread From: Mateusz Loskot @ 2018-12-04 19:00 UTC (permalink / raw) To: git On Thu, 29 Nov 2018 at 16:39, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > On Thu, Nov 29 2018, Mateusz Loskot wrote: > > On Thu, 29 Nov 2018 at 16:03, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote: > >> On Wed, Nov 28 2018, Mateusz Loskot wrote: > >> > > >> > (using git version 2.19.2.windows.1) > >> > > >> > I've just encountered one of those WTH moments. > >> > > >> > I have a bare repository > >> > > >> > core.git (BARE:master) $ git branch > >> > 1.0 > >> > 2.0 > >> > * master > >> > > >> > core.git (BARE:master) $ git tag > >> > 1.0.1651 > >> > 1.0.766 > >> > 2.0.1103 > >> > 2.0.1200 > >> > > >> > I published the repo using: git push --all --follow-tags > >> > > >> > This succeeded, but there seem to be no tags pushed, just branches. > >> > So, I followed with > >> > > >> > core.git (BARE:master) $ git push --tags > >> > To XXX > >> > - [deleted] 1.0 > >> > - [deleted] 2.0 > >> > ! [remote rejected] master (refusing to delete the current > >> > branch: refs/heads/master) > >> > error: failed to push some refs to 'XXX' > >> > > >> > And, I've found out that all branches and tags have been > >> > wiped in both, local repo and remote :) > >> > > >> > I restored the repo and tried out > >> > > >> > git push origin 1.0 > >> > git push origin --tags > >> > > >> > and this time both succeeded, without wiping out any refs. > >> > > >> > Could anyone help me to understand why remote-less > >> > > >> > git push --tags > >> > > >> > is/was so dangerous and unforgiving?! > >> > >> Since nobody's replied yet, I can't see what's going on here from the > >> info you've provided. My guess is that you have something "mirror" set > >> on the remote. > > > > Thank you for responding. > > > > The git push --tags hugely surprised me, and here is genuine screenshot > > https://twitter.com/mloskot/status/1068072285846859776 > > > >> It seems you can't share the repo or its URL, but could you share the > >> scrubbed output of 'git config -l --show-origin' when run inside this > >> repository? > > > > Here is complete output. I have not stripped the basics like aliases, > > just in case. > > Right, it's because you used --mirror, the important bit: > > > file:config remote.origin.url=https://xxx.com/core-external-metadata.git > > file:config remote.origin.fetch=+refs/*:refs/* > > file:config remote.origin.mirror=true > > file:config > > I.e. you have cloned with the --mirror flag, this is what it's supposed > to do: https://git-scm.com/docs/git-clone#git-clone---mirror > https://git-scm.com/docs/git-fetch#git-fetch---prune > > I.e. you push and git tries to mirror the refs you have locally to the > remote, including pruning stuff in the remote. Thank you very much for diagnosing my issue. I was not aware about how --mirror affects the workflow. It all makes perfect sense now. Best regards, -- Mateusz Loskot, http://mateusz.loskot.net ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-12-04 19:01 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-28 16:50 Simple git push --tags deleted all branches Mateusz Loskot 2018-11-28 18:13 ` Mateusz Loskot 2018-11-29 15:03 ` Ævar Arnfjörð Bjarmason 2018-11-29 15:18 ` Mateusz Loskot 2018-11-29 15:39 ` Ævar Arnfjörð Bjarmason 2018-12-04 19:00 ` Mateusz Loskot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.