Changing SSH Default Port for Linked Stash
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Symptoms
Bamboo and Stash are integrated and Stash is added as a linked repository. Trying to configure Stash to use a non-default SSH port now (Ex.:8090, instead of the default 7999) doesn't seem to work. Port 7999 stays in use and following error shows up when trying to clone from the Stash server:
1
(com.atlassian.bamboo.repository.RepositoryException : java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.RepositoryException: : ssh://git@xx.xx.xx.xx:7999/xx/xx.git: java.net.ConnectException: Connection refused)
Cause
Bamboo stores Stash port information when repository definition is created. So when changing Stash SSH port settings after having the repository in place, bamboo is not aware of that change and will use old data. It's unfortunately not possible to change this information from the UI.
We have an open improvement request to change this behavior: Bamboo should not store Stash SSH port in repository definition but rather use the currently configured one.
Solution
Resolution
There are two ways to fix this issue:
For each plan edit the repository and re-select server/repository/branch, this should overwrite the port settings
Modify settings directly in the database (Doable if you use external DB engine and some DB management tool). Make sure to back up your Bamboo database, stop Bamboo completely and check for the occurrences of the old/default port in "repositoryUrl". The run a command similar to the following to replace the port:
1
UPDATE VCS_LOCATION SET XML_DEFINITION_DATA = REPLACE(XML_DEFINITION_DATA, '7999', '8090');
Was this helpful?