Unable Pull Code from Stash
Asked by John Giotta:

I have bamboo and Stash on the same Windows Server 2008 machine. Bamboo on port 8085 and Stash on 7990.

Bamboo service is running as one user whil Stash runs as another.

I've tried installing GIT for Windows, cygwin for ssh, .ssh/config modifications and all without success.

I just don't think bamboo is using the right keys or at least the user is not the user running the service.

```
Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command C:\GitStack\git\bin\git.exe ls-remote ssh://&lt;UUID&gt;@127.0.0.1:53634/SPEC/repo.git failed with code 128. Working directory was [.]., stderr:[Host key verification failed., fatal: Could not read from remote repository., , Please make sure you have the correct access rights, and the repository exists.]
```

Bamboo Version: 4.4.4 build 3506 - 28 Feb 13

Stash version: 2.2.0

I'm running trial license of stash so my time is limited.


Answers:
author: John Giotta
body: Solved my problem. Originally, we had authenication errors and took to the interwebs for resolution. Many Atlassian Answers and Jira tickets led us to believe the built-in Git was at fault.

So we removed the suggested third-party Git from server capabilities. With the built-in Git, we were able to successfully pull code.


author: Michael Heemskerk
body: Stash ships with an embedded SSH server and does not use the SSH configuration of the server it's been installed on. You'll need to upload the public key that Bamboo is using to Stash (Profile \> SSH Keys \> Add Key).

Also make sure you use the SSH port that is listed in the SSH clone urls displayed in Stash as the Stash SSH port may differ from the default SSH port on the server.

comments: author: John Giotta
body: > "You'll need to upload the public key that Bamboo"

How do I find out which key Bamboo is using?


author: cofarrell
body: Hi John,

You will need to set the authentication type and upload a private key as part of the repository information in Bamboo. The corresponding public key can then be uploaded to Stash. You may need to [generate](https://confluence.atlassian.com/display/STASH/Adding+an+SSH+key+to+your+Stash+profile+on+Linux+and+Mac#AddinganSSHkeytoyourStashprofileonLinuxandMac-3.Generateanewkey) a new or separate key if you don't already have one.

<https://confluence.atlassian.com/display/BAMBOO/Git>

Cheers,

Charles


author: cofarrell
body: Hi John,

Just out of curiosity using the same URL as Bamboo can you clone to your desktop or manually from the server itself? Does it give you the same error? If you do, you could possible use the following scripts to clone and attach the log file to a new [support](https://support.atlassian.com) ticket.

<https://bitbucket.org/atlassian/git-client-debug/>

Cheers,

Charles


author: John Giotta
body: I've done the generating. This is what I did:

From my desktop I generated a key, pasted the public key content into my profile of Stash.

Then in Bamboo created a plan with a Git repo. Chose SSH auth and uploaded my private key and entered a passcode.

Saved.

Added a Git checkout task to the Default stage.

Saved.

Then Run Plan.

The result is the error I mentioned in the primary question.


author: John Giotta
body: Yes. No, error. Locally it works fine. I can clone to my desktop and from command line of the Bamboo server. It's only when Bamboo itself does the clone does it fail.

Now I mentioned Bamboo server runs as a different user and not me. So I'm not sure which user@domain is coming across to Stash.


author: cofarrell
body: Hi John,

Sorry for the delay. I didn't have access to a computer over the weekend. I'm afraid we're not entirely sure what's going wrong. Can you triple-check that the SSH URL that you're using for Stash is exactly the same as what you used from the command line on the server. Do you mind posting that here as well. I ask because the \<UUID\> part of your initial question is a little concerning and not what we would expect. Maybe a screenshot of the Bamboo configuration?

If that doesn't help you're best bet to raise an actual [support](https://support.atlassian.com/) ticket so we can ask you to post the support zip which might shed some more light on the issue.

Cheers,

Charles


author: John Giotta
body: Re-checked the SSH URL from Stash and all is correct.

I omitted the UUID to save on real estate.

**EDIT** the Path for Executable Git is incorrect. I was getting a bit desperate during my debugging session.

![](../../upfiles/bamboo_server_caps.JPG)

![](../../upfiles/bamboo_git_config.JPG)


author: cofarrell
body: Hi John,

I don't feel like we're getting anyway, and we'd like to help. If you haven't already please raise a [support](https://support.atlassian.com) ticket so we can arrange a screensharing session to help you resolve this issue.

Cheers,

Charles


author: Przemek Bruski
body: Which version of Bamboo is it?

Older versions have problems if the temp directory contains a space in its name. Try creating c:\\somedir and passing -Djava.io.tmpdir=c:\\somedir to you Bamboo.

comments: author: John Giotta
body: 4.4.4 build 3506 - 28 Feb 13


Tags: bitbucket-server