{"meta":{"title":"About locked repositories","intro":"Repositories can be locked to prevent changes, often for migrations.","product":"Migrations","breadcrumbs":[{"href":"/en/migrations","title":"Migrations"},{"href":"/en/migrations/overview","title":"Overview"},{"href":"/en/migrations/overview/about-locked-repositories","title":"Locked repositories"}],"documentType":"article"},"body":"# About locked repositories\n\nRepositories can be locked to prevent changes, often for migrations.\n\n## About locked repositories\n\nWhen you migrate repositories to or from GitHub products, your origin and destination repositories may be “locked” for migration. While a repository is locked, you cannot make any changes to the repository, such as pushing commits, creating issues, or commenting on pull requests.\n\nWhether your repositories will be locked during migration depends on the tooling you use and the options you choose when you run the migration. When a repository is locked, a banner with the following text is displayed on the repository's page on GitHub:\n\n> This repository is currently being migrated. It's locked while the migration is in progress.\n\nOften, repositories are unlocked automatically when the migration is complete. In other cases, unlocking a repository is a manual step, and the process required to unlock a repository depends on the migration tool you used.\n\n## Repositories locked by GitHub Enterprise Importer\n\nWhile a migration is in progress, access to the destination repository is locked by GitHub Enterprise Importer. If the migration completes successfully, the repository will unlock automatically. However, if there's a problem with the migration, including a migration failure, the repository may remain locked.\n\nGitHub Enterprise Importer does not lock source repositories by default. Source repositories will only be locked if you specify the `--lock-source-repo` option in the GitHub CLI, or the `lockSource` attribute in the `startRepositoryMigration` GraphQL mutation.\n\n> \\[!NOTE]\n> We do not recommend locking source repositories unless you are certain you will not want to unlock them later. Consider archiving the repositories instead. For more information, see [Archiving repositories](/en/repositories/archiving-a-github-repository/archiving-repositories).\n\nFor information about how to unlock repositories that were locked by GitHub Enterprise Importer, see [Troubleshooting your migration with GitHub Enterprise Importer](/en/migrations/troubleshooting/troubleshooting-your-migration-with-github-enterprise-importer#locked-repositories).\n\n## Repositories archived by Enterprise Live Migrations\n\nIn the latest GitHub Enterprise Server releases, Enterprise Live Migrations archives, rather than locks, the source repository. This keeps the repository available for read operations.\n\nIf a cutover fails after the source repository has been archived, the ELM service will attempt to unarchive the repository. If this fails, a repository administrator can unarchive the repository. See [Archiving repositories](/en/repositories/archiving-a-github-repository/archiving-repositories#unarchiving-a-repository).\n\nBe aware that unarchiving a repository will cause additional load on the instance, as all issues and pull requests in the repository will be reindexed in Elasticsearch.\n\nAfter the source repository is unarchived, you can either retry cutover using `gh elm migration cutover --migration-id MIGRATION-ID`, or abort the migration with `gh elm migration cancel --migration-id MIGRATION-ID` and start a new migration when you're ready.\n\n## Repositories locked by the \"Organization migrations\" REST API\n\nWhen you call the [Start an organization migration](/en/rest/migrations/orgs#start-an-organization-migration) endpoint to generate a migration archive for a source repository, the repository is not locked by default. The repository is only locked if you set the `lock_repositories` parameter to `true`.\n\nIf you lock a repository via this endpoint, you can unlock the repository using the [Unlock an organization repository](/en/rest/migrations/orgs#unlock-an-organization-repository) endpoint.\n\nIf the repository is stored on GitHub Enterprise Server, a site administrator can also unlock the repository using the site admin dashboard. For more information, see [Locking a repository](/en/enterprise-server@3.22/admin/managing-accounts-and-repositories/managing-repositories-in-your-enterprise/locking-a-repository) in the GitHub Enterprise Server documentation.\n\n## Repositories locked by `ghe-migrator`\n\nWhen you use `ghe-migrator`, the destination repository on GitHub Enterprise Server is locked by default and is not automatically unlocked.\n\nIf the import succeeded, you can unlock the repository with the `ghe-migrator unlock` command. For more information, see [Migrating data to GitHub Enterprise Server](/en/migrations/using-ghe-migrator/migrating-data-to-github-enterprise-server#unlocking-repositories-on-the-target-instance).\n\nIf the import failed, not all of your data has been migrated, and we recommend deleting the repository and retrying the migration, to prevent data loss.\n\nIf you're sure you want to use the repository, a site administrator can unlock the repository using the site admin dashboard. For more information, see [Locking a repository](/en/enterprise-server@3.22/admin/managing-accounts-and-repositories/managing-repositories-in-your-enterprise/locking-a-repository) in the GitHub Enterprise Server documentation.\n\nThe source repository is not locked by default, only if the `--lock` argument is specified when preparing the repository for export with the `ghe-migrator add` command. To unlock the repository, use the `ghe-migrator unlock` command. For more information, see [Migrating data to GitHub Enterprise Server](/en/migrations/using-ghe-migrator/migrating-data-to-github-enterprise-server#unlocking-repositories-on-the-source).\n\n## Repositories locked by the `startImport` GraphQL mutation\n\nWhen you use the `startImport` GraphQL mutation, the destination repository is locked by default and is not automatically unlocked.\n\nIf the import succeeded, you can unlock the repository with the `unlockImportedRepositories` GraphQL mutation. For documentation, contact your Expert Services or GitHub Partner representative.\n\nIf the import failed, you cannot unlock the repository yourself. Because a failed migration means that not all of your data has been migrated, we recommend deleting the repository and retrying the migration, to prevent data loss.\n\nIf you’re sure you want to unlock the repository, contact us through the [GitHub Support portal](https://support.github.com)."}