Rename Project's Repository or Branch
In this guide, you'll learn how to handle renaming your Cloud project's Git repository or its main branch, and how it affects your Cloud project.
Renaming Repository of a Cloud Project#
If you rename the Git repository of your Cloud project, Medusa will automatically update the repository URL in your Cloud project settings to reflect the new repository name.
However, you need to ensure that your GitHub connection is configured to give Medusa access to the renamed repository. This is necessary for Medusa to continue fetching your code and deploying your environments on Cloud.
To reconfigure your GitHub connection after renaming your repository:
- On GitHub, click on your avatar at the top right and choose "Settings" from the dropdown.
- In the left sidebar, click on "Applications".
- Click on the "Configure" button of the "Medusa" application.
- In the "Repository access" section, ensure that either "All repositories" is selected, or if "Only select repositories" is selected, ensure that the renamed repository is included in the list.
If your repository is an organization repository, ensure that the GitHub organization also has the renamed repository in its list of repositories that Medusa can access.
Renaming Branch of a Cloud Project's Repository#
If you rename the branch associated with an environment of your Cloud project, you need to update the deployment rules of that environment to use the new branch name.
To rename the branch associated with an environment of your Cloud project:
- From the organization's dashboard, click on the environment's project.
- In the project's dashboard, click on the name of the environment. For example, "Production".
- In the environment's dashboard, click on the "Settings" tab.
- Choose the "Deployment rules" tab from the sidebar.
- You'll find a
branchrule. You can edit it by clicking the icon and choosing "Edit" from the dropdown. - In the side window that opens, you can change the branch that the environment is connected to. For example, you can change it from
maintostagingto create a new deployment every time you push a commit to thestagingbranch. - Click "Save" to apply the changes.
The deployment rules will take effect for next deployments. So, the next time you push a commit to the renamed branch, it will trigger a new deployment of the environment.