Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
April 17, 2023 06:21 pm GMT

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 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: GitlabSyncon:  - push  - deletejobs:  sync:    runs-on: ubuntu-latest    name: Git Repo Sync    steps:    - uses: actions/checkout@v3      with:        fetch-depth: 0    - uses: wangchucheng/[email protected]      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.


Original Link: https://dev.to/carbans/sync-repos-beetwen-github-gitlab-b3b

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To