Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-11161

Allow to switch Bitbucket to read-only mode


    • Icon: Suggestion Suggestion
    • Resolution: Unresolved
    • None
    • None
    • None
    • 178
    • We collect Bitbucket feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Problem Definition

      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

      Suggested Solution

      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.

      1. Disable SCM access on the admin's Server Settings page

        Cloning prevented:
          $ git clone ssh://git@example.com: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://admin@example.com:7990':
          fatal: remote error: SCM access over HTTP(S) has been disabled
          SCM access over HTTP(S) has been disabled 

        Pushing prevented:

          [/repo]$ git push
          fatal: remote error: SCM access over HTTP(S) has been disabled
          SCM access over HTTP(S) has been disabled 
      2. 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.

      Alternative workarounds

      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.

            Unassigned Unassigned
            ccurti Caterina Curti
            47 Vote for this issue
            44 Start watching this issue