Error when trying to push/mirror Gitlab private Project to GitHub Private Repo

I’m trying to migrate my GitHub repos to GitLab but would like to keep those repo’s in sync with a GitLab upstream for the social aspects of GitHub.

Since I’m on a Free acccount, I understand that I cannot pull(mirror) from GitHub but am getting an error message when I try to setup GitHub as a push(mirror) destination:

Steps I’ve taken:

  • Using
  • Created Personal Access Token on GitHub with repo access based on this guide.
  • Go to Project>Setting>Repository>Mirroring Repositories in Gitlab.
  • Enter URL for the private GitHub repo
  • Enter Access Token in the Password field.
  • Click on “Mirror repository” and then “Update now”.

I see the following error:

13:close stream to gitaly-ruby: rpc error: code = Unknown desc = Gitlab::Git::RepositoryMirroring::RemoteError: remote: Repository not found.
fatal: Authentication failed for ''

I can confirm that the repo exists in GitHub.

Does the “mirror repository” option not support private repositories as targets for free accounts?


I just checked tested, and it’s working. First:

make sure you have the following options selected:

give your access-token a name, and then copy the access token after saving.

Go to your Project --> Settings --> Repository --> Mirroring in gitlab. You need to make sure in the HTTP url that you put your username so:

so from your error above, something like:

then the mirroring will work. I just did this with a private repository, rather than a public one. I selected the other appropriate options since I might make package releases and so want to be able for the mirror to delete if I delete on gitlab.


Accessing a private repository as a push mirror target should work if you’ve generated a token with all repo level access, and you’ve added your username to the URL when defining the destination.

Per your error, it looks like GitHub is rejecting the authentication attempt.

Have you verified if your generated GitHub personal access token works against the selected repository, with a CLI test using it?

Edit: Looks like my response overlapped with @iwalker’s fine one!


Thank you for the detailed instructions!

As it turns out, specifying the HTTP Mirror URL as was the key. Once I changed the URL, the push to the GitHub private repo started working.

FWIW, I was able to keep the token permissions to just repo access as seen in the screenshot:

Screenshot_2020-12-04 GitHub