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, 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
$ git clone ssh://firstname.lastname@example.org:7999/proj/repo.git Cloning into 'repo'... ssh: connect to host example.com port 7999: Connection refused fatal: Could not read from remote repository.Please make sure you have the correct access rights and the repository exists. $ git clone http://example.com:7990/bitbucket/scm/proj/repo.git Cloning into 'repo'... Username for 'http://example.com:7990': admin Password for 'http://email@example.com:7990': fatal: remote error: SCM access over HTTP(S) has been disabled SCM access over HTTP(S) has been disabled
[/repo]$ git push fatal: remote error: SCM access over HTTP(S) has been disabled SCM access over HTTP(S) has been disabled
- 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:
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.
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.