Authentication fails when trying to mirror GitLab.com repo to GitHub

Hi all,

I’m trying to set up the “Push to a remote repository” feature set up in a GitLab.com repository. I have set up an empty project on GitHub.com, set up a personal access token, and I’m entering it in the form

https://username:personalaccesstoken@github.com/OrganizationName/ProjectName.git

but I keep getting the following error when I save and try to update:

remote: Invalid username or password.
fatal: Authentication failed for 'https://*****:*****@github.com/OrganizationName/ProjectName.git/'

Everything in there is correct.

Any thoughts on what I can try to fix this?

Thanks. :slight_smile:

2 Likes

Question is old, but I’ve just had the same issue and found the solution.

There is a mistake in Gitlab doc - pushing to remote repository or at least it is not clear (same for the embedded doc in the Gitlab app itself).

To mirror / synchronise from Gitlab to Github, by 2017-07-27 the doc says to fill in the Git repository URL like https://username:password@gitlab.company.com/group/project.git.

BUT for mirroring from Gitlab to Github, you should:

  1. Create a Github personal access token with the public_repo box checked.
  2. Fill in the Git repository URL with the personal access token instead of the password https://username:personalAccessToken@github.com/group/project.git
  3. Save
  4. Then trigger the “force update” button.

Hope this helps

1 Like

@mfaure
I’m actually running into this issue right now. I cannot for any reason have my repo push to GitHub. I’ve even created an access token with rights to everything and it still doesn’t work. I’m not sure if there’s something wrong with the GitLab API or the GitHub API. This will not work for any repository, whether freshly made or in an organization.

To be clear, I’m not getting an error like above. The system just flat out won’t work. Occaisionally when pressing the force update button I see “Error getting deploy keys” but then it moves on to “the remote repository is being updated…” and then nothing after.

1 Like

Hello.

I’m having the exact same issue but only with repos belonging to an organization I own.

For any personal repos on github, it works well.

But I created an organization for a few projects to group them together, and I cannot push mirror to those, I get a “authentification failed” error.

I tried to add the write:org permission to an access token but it still won’t work.

Any help would be very much appreciated :slight_smile:

1 Like

Well this didn’t work for me.
So I mirrored my repo by using this format https://username@github.com/group/project.git
and then entered Github token in password field.

1 Like

Thank you it work like charm for me.