There are various scenarios for this:
- migration to new sites keeping the older one active while removing the possibility to update it
- maintenance activities when Bitbucket can be accessible but no changes (in the configuration or in the database) should occur
Implement a read-only mode for Bitbucket.
Disable SCM access for both HTTP(S) and SSH and in browser file editing
Disable SCM access for both HTTP(S) and SSH, as well as disabling file editing in Bitbucket Server itself. This will prevent users from updating content in repositories, however note that disabling SCM access will also disable the ability to clone.
- Disable SCM access on the admin's Server Settings page
- Editing files in the browser would still work, but that can be disabled by setting the system property feature.file.editor to false (see Bitbucket Server config properties documentation).
Any other changes (e.g. pull request creation, permission changes or any administrative settings) will not be blocked.
Depending on your goal, you could also use one of these workarounds:
Remove write permissions using REST API endpoints
In this way, commit pushes to repositories and projects can be prevented but it will still be possible to create pull requests unless we completely remove the access (including the read-only one) to the repositories. Any other system changes (e.g. user directories, add on installation) cannot be prevented.
DNS rules update
At the DNS level, the traffic can be directed to static page indicating to the users that Bitbucket is not accessible and where to go instead (e.g. the URL of the new instance) In this case, both HTTP and SSH access has to be blocked as per above.