GitHub- How to Sync GitLab with GitHub and BitBucket

Sync GitLab to GitHub

To set up a mirror from GitLab to GitHub, you need to follow these steps:

1.Create a GitHub personal access token with the public_repo box checked.

Creating GitHub token
Profile > Settings > Developer settings > Personal access tokens > Generate New > Select the scopes, or permissions(public_repo cheked) >Generate

copy the token to your clipboard : HXCGGJsdfCGGsAASSssassSDDSDZsss

2.Login to Gitlab > Select Repository > Settings > Repository > Select : Mirroring repositories > Provide Below details

3.Fill in the Git repository URL field using this format:

https://<your_github_username>@github.com/<your_github_group or username>/<your_github_project>.git

#Example
https://smlcodes@github.com/smlcodes/springmvc.git

Cross Check By hitting above URL in browser

4.Fill in Password field with your GitHub personal access token.

5.Click the Mirror repository button.

The mirrored repository will be listed. For example, https://**:**\@github.com<your_github_group><your_github_project>.git.

The repository will push soon. To force a push, click the appropriate button

Sync GitLab to BitBucket

1.Open BitBucket > Profile > Settings > App Passwords > Create App Password

Select Permissions > Create

2.Copy Password

3.Login to Gitlab > Select Repository > Settings > Repository > Select : Mirroring repositories > Provide Below details

-Git repository URL : https://satyacodes@bitbucket.org/satyacodes/satyacodes.bitbucket.io.git

-Mirror direction : pull/push

-Authentication method : above copied password from bitbucket

4.Click on Create Mirror Repository.

5.It will add to the List. Please click update button to Test.

Ref.

https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html

https://docs.gitlab.com/ee/user/project/repository/repository_mirroring.html