When attempting to mirror a Git repo I receive a "not a git repository" error

1.5k Views Asked by At

I'm attempting to do this:

https://help.github.com/en/github/creating-cloning-and-archiving-repositories/duplicating-a-repository#mirroring-a-repository-in-another-location

The clone creats a [repo].git folder which only has an objects folder within it, and when I try to add the origin URL from with the created folder, I receive the not a git repository error because there is no .git folder in the [repo].git folder.

What am I missing?


These are the commands I'm using

git clone --mirror [URL]

cd [repo folder]

git remote set-url --push origin [new URL] <-- This is where I recieve the error

git push origin --mirror

1

There are 1 best solutions below

0
Josh Russo On

This is what I ended up getting to work. I'm not sure if the last push of tags is actually needed, but I threw it in for good measure

git clone --mirror [URL]
cd [repo folder]
git remote rm origin
git remote add origin [new URL] 
git push origin --mirror
git push --tags