BAMBOO-SSH-PROXY: [While connecting to [git@stash-baseURL/127.0.0.1:22]: Authenticating remote session failed
The following scenario was tested with Bamboo 5.6.0 and Stash 3.2 versions, where the application links between the applications are set up and working correctly.
No problem was thrown on adding a "Linked repository" with Repository host as Stash in Bamboo under "Bamboo administration >> Build resources >> Linked repositories" or adding the linked repository to a "Plan configuration >> Repositories" tab.
Once the build plan runs, the following appears in the
(com.atlassian.bamboo.repository.RepositoryException : java.lang.RuntimeException: com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.repository.RepositoryException: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote ssh://firstname.lastname@example.org:56335/sup/repository.git failed with code 128. Working directory was [.]., stderr: Authenticating remote session failed stdout: [Warning: Permanently added '[127.0.0.1]:56335' (RSA) to the list of known hosts., BAMBOO-SSH-PROXY: [While connecting to [git@stash-baseURL/127.0.0.1:22]: Authenticating remote session failed], fatal: Could not read from remote repository., , Please make sure you have the correct access rights, and the repository exists.])
Please, notice that port number 22 is in use instead of 7999 by default from Stash.
In Stash, under "Stash Administration >> Settings >> Server Settings", please notice the port number 7999 is missing from SSH base URL
In order to fix this issue, append SSH port (:7999) to the SSH base URL. As a result, you would have ssh://stash.localhost.dev:7999
After saving the changes in Stash, it is time to update your repository on Bamboo as per the following:
- go to "Bamboo administration >> Build resources >> Linked repositories" and select your Stash repository.
- Hit the "Save repository" button
- and go to the "Plan configuration >> Repositories" tab.
- Please make sure that Stash is configured as a Repository host and hit "Save repository."
- Run your build plan.
Note: If you still face issues after changing the SSH Base URL, please check your Proxy, Firewall configurations.
You may also see errors like those below. You could perform basic checks to see whether Bamboo server or the agents could reach the configured Bitbucket server.
BAMBOO-SSH-PROXY: [SSH proxy tried to connect to [email@example.com/10.111.66.77:7999]: and failed due to the following error: [Remote connection failed]: Failed to get the session.]
For example, commands like ssh or telnet to port 7999 of Bitbucket server.
ssh -p 7999 stash.localhost.dev -v telnet stash.localhost.dev 7999