cooperspencer / gickup

https://cooperspencer.github.io/gickup-documentation/
Apache License 2.0
939 stars 33 forks source link

Mirroring Private GitHub repositories to GitLab #231

Closed SethuSenthil closed 1 month ago

SethuSenthil commented 3 months ago

Hey! I am trying to backup/mirror my private GitHub repositories to Gitlab but I'm unable to do so. I get the following error:

POST https://gitlab.com/api/v4/projects: 422 {message: https://:@github.com/USER-NAME/REPO-NAME.git endpoint error: 401 Unauthorized} stage=gitlab url=https://gitlab.com

Here is my config yaml:


source:
  github:
    - token: TOKEN_STRING_HIDDEN
      ssh: false
      wiki: true
      issues: true
      starred: false
destination:
  gitlab:
    - token: TOKEN_STRING_HIDDEN
cooperspencer commented 3 months ago

Hi, I tried that with my account and got the same error message for my private repos on Github. Are the repositories, which cause the issue, private as well?

SethuSenthil commented 3 months ago

Yes, only private Github repos have this issue, public Github repos work as intended for Gitlab

cooperspencer commented 3 months ago

Ah, you even wrote that it happens for the private repos. Sorry, it is still early on my side :sweat_smile:

I'll look into it and try to fix it.

cooperspencer commented 3 months ago

I found the bug, a two year old bug. I used the password instead of the token, that should be fixed now.

https://github.com/cooperspencer/gickup/pull/232/files

SethuSenthil commented 3 months ago

Np man! Thanks so much for all the work you put in to maintain this free tool!

cooperspencer commented 3 months ago

Just to be clear, mirroring on Gitlab isn't working well. Pull mirrors are an enterprise feature and I don't have an enterprise account to properly test everything. I'll have to implement something like for the Github mirror to just clone it first and then push it to Gitlab.

SethuSenthil commented 3 months ago

Oh, I wasn't aware of that. I don't have an enterprise account either :(

cooperspencer commented 3 months ago

No problem, I will try to implement the Gitlab mirror feature and get back to you when it is done. It could take me a bit though.

SethuSenthil commented 3 months ago

Take your time! Thanks for everything so far!

cooperspencer commented 3 months ago

I implemented it now. The changes are in the main branch. Can you test that somehow? You'd just need to change the following on the gitlab destination.

source:
  github:
    - token: TOKEN_STRING_HIDDEN
      ssh: false
      wiki: true
      issues: true
      starred: false
destination:
  gitlab:
    - token: TOKEN_STRING_HIDDEN
      mirror:
        enabled: true
SethuSenthil commented 3 months ago

Just tested it out on MAIN with the modified config, seems to be working as expected! Thanks a lot!

cooperspencer commented 3 months ago

Perfect. A new release should be out within the next few days.

SethuSenthil commented 1 month ago

Resolved on #233 and released on v0.10.30