Sync Repos beetwen Github & Gitlab

I’m been using Gitlab since January 17, 2016 and I’m very happy with this tool for years was my main repository of code. But now I have some of repositories in Github and I want to sync them with Gitlab, because I want that Gitlab to be a source of tru…


This content originally appeared on DEV Community and was authored by Carlos

I'm been using Gitlab since January 17, 2016 and I'm very happy with this tool for years was my main repository of code. But now I have some of repositories in Github and I want to sync them with Gitlab, because I want that Gitlab to be a source of truth

I research a little bit and I found this repo that show me how I can do it.

First, we need to look at process of sync:

Flow of sync

We need to start creating workflow file into your repo in Github, you can find the file in this link

name: GitlabSync

on:
  - push
  - delete

jobs:
  sync:
    runs-on: ubuntu-latest
    name: Git Repo Sync
    steps:
    - uses: actions/checkout@v3
      with:
        fetch-depth: 0
    - uses: wangchucheng/git-repo-sync@v0.1.0
      with:
        # Such as https://github.com/wangchucheng/git-repo-sync.git
        target-url: ${{ secrets.TARGET_URL }}
        # Such as wangchucheng
        target-username: ${{ secrets.TARGET_USERNAME }}
          # You can store token in your project's 'Setting > Secrets' and reference the name here. Such as ${{ secrets.ACCESS\_TOKEN }}
        target-token: ${{ secrets.TARGET_TOKEN }}

As you can see we need to create 3 secrets to use this workflow:

Once you create the Token into Gitlab you need to add secrets into Github repository. To do these you need to go to Settings > Secrets and add the secrets.

These not it's the best way to do it, but it's a good way to start and simple way to do it and little maintenance.


This content originally appeared on DEV Community and was authored by Carlos


Print Share Comment Cite Upload Translate Updates
APA

Carlos | Sciencx (2023-04-17T18:21:56+00:00) Sync Repos beetwen Github & Gitlab. Retrieved from https://www.scien.cx/2023/04/17/sync-repos-beetwen-github-gitlab/

MLA
" » Sync Repos beetwen Github & Gitlab." Carlos | Sciencx - Monday April 17, 2023, https://www.scien.cx/2023/04/17/sync-repos-beetwen-github-gitlab/
HARVARD
Carlos | Sciencx Monday April 17, 2023 » Sync Repos beetwen Github & Gitlab., viewed ,<https://www.scien.cx/2023/04/17/sync-repos-beetwen-github-gitlab/>
VANCOUVER
Carlos | Sciencx - » Sync Repos beetwen Github & Gitlab. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/04/17/sync-repos-beetwen-github-gitlab/
CHICAGO
" » Sync Repos beetwen Github & Gitlab." Carlos | Sciencx - Accessed . https://www.scien.cx/2023/04/17/sync-repos-beetwen-github-gitlab/
IEEE
" » Sync Repos beetwen Github & Gitlab." Carlos | Sciencx [Online]. Available: https://www.scien.cx/2023/04/17/sync-repos-beetwen-github-gitlab/. [Accessed: ]
rf:citation
» Sync Repos beetwen Github & Gitlab | Carlos | Sciencx | https://www.scien.cx/2023/04/17/sync-repos-beetwen-github-gitlab/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.