An Interest In:
Web News this Week
- April 29, 2024
- April 28, 2024
- April 27, 2024
- April 26, 2024
- April 25, 2024
- April 24, 2024
- April 23, 2024
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:
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:
- TARGET_URL => https://gitlab.com/username/test.git
- TARGET_USERNAME => your username in Gitlab
- TARGET_TOKEN => Access token of your repo settings in Gitlab
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
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To