Stash is now known as Bitbucket Server.
See the

Unknown macro: {spacejump}

of this page, or visit the Bitbucket Server documentation home page.


For long-term use on a Windows server, Stash should be configured to run as a Windows service. This has the following advantages:

  • Stash will be automatically restarted when the operating system restarts. 
  • Stash is less likely to be accidentally shut down, as can happen if the console window Stash was manually started in is closed.
  • Stash logs are properly managed by the Windows service.




  • If you are running a 64-bit version of Windows and a 64-bit JVM, then the tomcat7.exe and tcnative-1.dll binaries in the /bin directory need to be replaced with their .x64 counterparts.
  • On any Windows operating system with User Account Control (UAC) such as Windows Vista or Windows 7, simply logging in to Windows with an Administrator account will not be sufficient to execute the script in the procedure below. You must either disable UAC or run 'cmd.exe' as an administrator (e.g. by right-clicking on 'cmd.exe' and choosing Run as administrator).
  • Ensure the JAVA_HOME variable is set to the root of your Java platform's installation directory.
    Note: Your JAVA_HOME cannot contain spaces, so the default Java installation directory of C:\Program Files\Java won't work.
  • When you run Stash as a Windows service, all settings in setenv.bat are ignored. Ensure that you have set STASH_HOME as a system environment variable.
  • If you upgraded Stash from version 1.x to 2.x and Stash stopped running as a service you will need to reinstall the service according to instructions in the Stash upgrade guide.
  • You cannot run Stash as a service on a 64-bit operating system if you require allocating more than 1.5GB of memory, due to 32-bit JDK memory limitations and 64-bit JDK/Tomcat service issues.

Setting up Stash as a Windows service

To run Stash as a Windows service:

  1. Stop Stash.
  2. Open a Command Prompt (as an Administrator – see the Before you start section above).
  3. Change directory to the Stash installation directory and then into the bin subdirectory. If a directory in the path has spaces (e.g. C:\Program Files\..), use its eight-character equivalent (e.g. C:\Progra~1\..).
  4. Run the following commands:

    > service.bat install
    > tomcat7 //US//STASH --Startup auto

    This will create a service with the name "STASH" and a display name of "Atlassian Stash".  If you would like to customize the name you can instead run:

    > service.bat install MyName
    > tomcat7 //US//MyName --Startup auto

    This will create the service as "MyName" with a display name of "Atlassian Stash MyName".

  5. Run the following command to increase the amount of memory that Stash can use (the default is 768 Mb):

    > tomcat7 //US//service_name --JvmMx 1024
  6. Verify that the Stash service comes back up after restarting the machine.


C:\Program Files (x86)\atlassian-stash-2.0.0\bin>service.bat install
Installing the service 'STASH' ...
Using CATALINA_HOME:    "C:\Program Files (x86)\atlassian-stash-2.0.0"
Using CATALINA_BASE:    "C:\Program Files (x86)\atlassian-stash-2.0.0"
Using JAVA_HOME:        "C:\Java\jre6"
Using JVM:              "auto"
The service 'STASH' has been installed.
C:\Program Files (x86)\atlassian-stash-2.0.0\bin>tomcat7.exe //US//STASH --Startup auto
C:\Program Files (x86)\atlassian-stash-2.0.0\bin>tomcat7.exe //US//STASH --JvmMx 1024
C:\Program Files (x86)\atlassian-stash-2.0.0\bin>net start STASH
The Atlassian Stash service is starting.
The Atlassian Stash service was started successfully.



  • Problems may occur when trying to setup Stash to run as a Windows service with JDK 1.6. The problem is due to failure to locate MSVCR71.DLL, which can be found in %JAVA_HOME%/bin. There are two options to resolve this problem:
    • Add %JAVA_HOME%/bin to PATH, then restart the Stash server.
    • Copy MSVCR71.DLL to system path, C:\WINDOWS\SYSTEM32 or C:\WINNT\SYSTEM32.
  • Take note of the username that the service is running as. Stash needs to be run as a non-administrator user with read and write access to the Stash home directory and the <Stash installation directory>.
  • ラベルなし