Why do I get an error when I use the git mirror command?

2.3k views Asked by At

I'm having trouble mirroring my repository. The following commands works:

git clone --bare https://github.com/my_username/my-repo.git
cd my-repo

There is another repository which is empty that I want mirrored. That repository is owned by another person but I have access to it as I can see it in my GitHub account.

When I execute the following command, I get an error:

git push --mirror https://github.com/their-username/their-repo

remote: Repository not found.
fatal: repository ‘https://github.com/their-username/their-repo/’ not found

Repositories:

  1. https://github.com/my-username/my-repo (This is my repo which has my username)
  2. https://github.com/their-username/their-repo (This is their repo which has their username)

I am trying to mirror 1 into 2. I can successfully clone both repositories

2

There are 2 answers

1
Joe On

Git has mirror functionality built right into it

From your repo

git push --mirror https://github.com/their-username/their-repo

Note that this will completely overwrite their repo so you should make sure that they are OK with this.

0
alex On

The answer is:

I had read-only access and not read-write access. I emailed my organistaion and they changed this and it worked.