1

I have a Git repository on a internal private network that I would like to move to another internal private network. The two networks are not connected to each other. I created a mirror of the source repository using:

git clone --mirror <URL to my OLD repo location>

I transferred the cloned files to the destination network and they are stored in the ~/project.git directory. On the destination network I have a new repository which is only populated with a README file.

I saw one similar question which recommended this:

git remote set-url origin <URL to my NEW repo location>
git push -f origin

However, the push -f option is blocked per IT policy. I've tried cloning the new repo and running this:

git pull ~/project.git master

But that have me an error due to the unrelated histories and didn't copy the history over. How can I merge the contents of a mirrored Git repo (all of the history for multiple branches) into a new repo? Thanks!

EylM
  • 5,967
  • 2
  • 16
  • 28
jmq
  • 1,559
  • 9
  • 21
  • Just clone it, ignoring that other new repository with a readme file. `git clone ~/project.git `. Or is "NEW location" not in the same filesystem as `~/project.git`? – mkrieger1 Aug 05 '19 at 21:22

1 Answers1

2

The two networks are not connected to each other.

Then use a git bundle: you can copy one file, then pull from it in a new empty local repository on your second network.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250