Repository mirroring is a feature in Code Studio. With this feature, you can synchronize your Code Studio git repository with an external repository managed by another git provider.
Similar to any mirroring activity, a repository can be mirrored in two directions:
Currently, Code Studio only supports mirroring out to another git repository. However, it is possible to facilitate the process of mirroring another repository into Code Studio using an existing, non-Code Studio CI/CD solution.
Mirroring Code Studio out to another repository
This method of mirroring Code Studio out to another repository is also called a “push.”
Important
Repository mirroring is configured in the Settings of your Code Studio account, which requires administrative permissions to access. These permissions are available with the Owner role in Code Studio. For more information, see Code Studio user roles.
To set up mirroring Code Studio out to another repository:
Log in to your target repository.
This is the target repository where you will mirror your Code Studio project.
Generate an access token.
You will later use this token instead of your password.
In the left navigation, click Settings > Repository.
Click Expand next to Mirroring repositories to expand the section.
Fill in the required information, including:
In the Git repository URL, enter the URL where Code Studio will push.
In Authentication method, select Password.
In Password, enter the token that you generated in Step 2.
Click Mirror repository.
Verify that the Mirrored repositories table displays your repository.
Repository mirroring is now configured. Any commits made into your Code Studio repository are now automatically mirrored or pushed out to your external repository.
The following is an example for mirroring a Bitbucket repository into Code Studio. This methodology can be adapted for use with most git and CI/CD providers.
Note
You must authenticate Code Studio with BitBucket if you want Code Studio to pull code from a private BitBucket repository. You can use multiple ways for authentication. Acquia recommends you to follow this tutorial.
Any subsequent commits and creation/deletion of a branch are mirrored to Code Studio.
Note
This only mirrors git history. It does not mirror any metadata generated in BitBucket such as issues and comments in PRs.
Configuring repository mirroring in Code Studio
Repository mirroring is a feature in Code Studio. With this feature, you can synchronize your Code Studio git repository with an external repository managed by another git provider.
Similar to any mirroring activity, a repository can be mirrored in two directions:
Currently, Code Studio only supports mirroring out to another git repository. However, it is possible to facilitate the process of mirroring another repository into Code Studio using an existing, non-Code Studio CI/CD solution.
Mirroring Code Studio out to another repository
This method of mirroring Code Studio out to another repository is also called a “push.”
Important
Repository mirroring is configured in the Settings of your Code Studio account, which requires administrative permissions to access. These permissions are available with the Owner role in Code Studio. For more information, see Code Studio user roles.
To set up mirroring Code Studio out to another repository:
Log in to your target repository.
This is the target repository where you will mirror your Code Studio project.
Generate an access token.
You will later use this token instead of your password.
In the left navigation, click Settings > Repository.
Click Expand next to Mirroring repositories to expand the section.
Fill in the required information, including:
In the Git repository URL, enter the URL where Code Studio will push.
In Authentication method, select Password.
In Password, enter the token that you generated in Step 2.
Click Mirror repository.
Verify that the Mirrored repositories table displays your repository.
Click Sync, which is the circular arrows icon to the far right of the table.
Repository mirroring is now configured. Any commits made into your Code Studio repository are now automatically mirrored or pushed out to your external repository.
The following is an example for mirroring a Bitbucket repository into Code Studio. This methodology can be adapted for use with most git and CI/CD providers.
Note
You must authenticate Code Studio with BitBucket if you want Code Studio to pull code from a private BitBucket repository. You can use multiple ways for authentication. Acquia recommends you to follow this tutorial.