# Get rid of `warning: refs/remotes/origin/master usually tracks refs/heads/master, not refs/remotes/origin/master`

2 messages from 2023-02-23 to 2023-02-25. Participants: Andry.
Thread: https://gitlist.dev/t/59292

## Andry, 2023-02-23 03:21

Subject: Get rid of `warning: refs/remotes/origin/master usually tracks refs/heads/master, not refs/remotes/origin/master`
Message-ID: <942870379.20230223062101@inbox.ru>
URL: https://gitlist.dev/e/942870379.20230223062101%40inbox.ru

```
Hello Git,

Found this issue and could find a solution.

Repro steps:

1. create a simple repo with only the master branch.
2. `git pull origin *:*` to allocate all refs (no warnings)

If try to mirror the repo into the same remote:

1. `git push origin --mirror`

Then the remote counter part falls into the mirror state and reports the warning:

1. `git pull origin *:*`

ˋˋˋ
warning: refs/remotes/origin/master usually tracks refs/heads/master, not refs/remotes/origin/master
Already up to date.
ˋˋˋ

Tried to delete all refs in the local and remote. But didn't work. Somehow the remove remember the state.

Is there a way to unmirror the remote repository back?


```

## Andry, 2023-02-25 21:48

Subject: Re: Get rid of `warning: refs/remotes/origin/master usually tracks refs/heads/master, not refs/remotes/origin/master`
Message-ID: <1212192063.20230226004808@inbox.ru>
URL: https://gitlist.dev/e/1212192063.20230226004808%40inbox.ru
In-Reply-To: <942870379.20230223062101@inbox.ru>

```
Hello Git,



Thursday, February 23, 2023, 6:21:01 AM, you wrote:

A> Found this issue and could find a solution.

A> ...

A> Is there a way to unmirror the remote repository back?

Seems the problem was in the logic of the push algorithm.

There was 2 fors (pseudocode):

ˋˋˋpython
for remote in remotes:
  for branch in branches:
    git_push([remote, ':refs/remotes/' + remote + '/' + branch])
ˋˋˋ

Instead of 3 fors:

ˋˋˋpython
for remote in remotes:
  for ref_remote in remotes:
    for branch in branches:
      git_push([remote, ':refs/remotes/' + ref_remote + '/' + branch])
ˋˋˋ

Because each remote has `num(refs) = num(branches) x num(remotes)` after the mirror.


```
