Is there a way to push Azure Repository to Gitlab one?

163 Views Asked by At

There are 2 companies

Company A uses Azure Repos Company B uses Gitlab Repos

I need to set up repos mirroring Push Gitlab to Azure and Push Azure to Gitlab. In the first case, it was fairly simple to push Gitlab to Azure, using built-in GitLab function Mirroring.

However, I am struggling to find a way how to push Azure Repo to Gitlab repo.

I have tried creating service connection in Azure Devops project and then creating Azure Pipeline as powershell script (Note: In example below, PATs are random numbers for better visualisation):

Write-Host Starting the synchronization process mkdir copyrepo $sourceURL = "https://$(Gl684feafeaag56416agvr)@$(https://gitlab.com/blabla/myproject.git)" $destURL = "https://$(Az14d4w846acf)@$(https://[email protected]/BlaBla/AzProject/_git/AzProject)" Set-Location "$(Build.SourcesDirectory)/copyrepo" git clone --mirror $sourceURL Set-Location "$(Build.SourcesDirectory)/copyrepo/$(myproject)/" Write-Host "*Git removing remote origin" git remote rm origin Write-Output "*Git remote add" git remote add --mirror=fetch origin $destURL Write-Output "*Git fetch origin" git fetch $sourceURL Write-Output "*Git push to Azure Repos" git push origin --all -f

It ends up with: git checkout failed with exit code 1 I have even tried to enable checkout for any nested submodule, but stil getting the same error.

Is this even a good way of approaching the goal to push azure repo to gitlab, or is there a better way ?

0

There are 0 best solutions below