0

I'm configuring BitBucket pipelines to mirror the repository to Github:

clone:
  depth: full
pipelines:
  default:
    - step:
        script:
          - git push --mirror git@github.com:MyOrg/mirror-repo.git

But I want the commit history not the be available in Github. The history is for BitBucket and just a dump of the repo should be added to Github. What flags can I add to the git command to achieve this?

user1469734
  • 851
  • 14
  • 50
  • 81
  • 2
    There are [several](https://stackoverflow.com/questions/50992188/how-to-push-a-shallow-clone-to-a-new-repo) [questions](https://stackoverflow.com/questions/38275371/git-push-shallow-clone-to-a-new-remote-without-unshallow) related to this and all of them seem to have ended in a workaround: create a new repository with just the intended commits and push that. I don't think a real "shallow push" is supported in git at this point (shallow clone is supported after not being supported for a long time, so maybe this will eventually come as well). – Joachim Sauer Apr 22 '21 at 08:59
  • No that is different from my question - I'm talking about a mirror – user1469734 Apr 22 '21 at 09:02
  • 1
    I don't think mirror or not significantly modifies the question. That only really affects what happens to tags during the push, it's still fundamentally a `git push`. The issue that you want to have a shallow push is the real stumbling block. – Joachim Sauer Apr 22 '21 at 09:08
  • 1
    What do you expect a mirrored repo to be if you remove all the commits except one? – evolutionxbox Apr 22 '21 at 09:38
  • @evolutionxbox's question is the key. What, precisely, do you want? Joachim Sauer's comment is the answer, once you've answered the key question yourself (what you want): make a *new* repository with what you want to have in it. – torek Apr 23 '21 at 00:24

0 Answers0