Bamboo Git authentication fails
Asked by Greta Chang:

I'm completely new to both Bamboo and Git, so bear with me. I'm running Bamboo 4.4.5 and Git 1.7 on Ubuntu 12.04. I can't seem to get Bamboo to access my remote Git repository no matter how I format the repo URL. I've tried [https://GretaChang](https://GretaChang%40razer.git.cloudforge.com/systems.git)@razer.git.cloudforge.com/systems.git, with authentication set to username/password. I've tred <https://razer.git.cloudforge.com/systems.git>, with username/password. Among other combinations, I even tried [https://GretaChang:\*\*\*\*\*](https://GretaChang:*****%40razer.git.clouforge.com/systems.git)@razer.git.clouforge.com/systems.git, with the password where the asterisks are. All of them give me the same error log, with the slightest differences in the fatal error message:

```
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote https://razer.git.cloudforge.com/sytems.git failed with code 128. Working directory was [.]., stderr:[fatal: Authentication failed]	at com.google.common.cache.AbstractCache.getUnchecked(AbstractCache.java:51)	at com.atlassian.bamboo.plugins.git.CallableResultCache.call(CallableResultCache.java:82)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:512)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:447)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:542)	at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:192)	... 43 moreCaused by: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote https://razer.git.cloudforge.com/sytems.git failed with code 128. Working directory was [.]., stderr:[fatal: Authentication failed]	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:431)	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:350)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper$1.call(NativeGitOperationHelper.java:500)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper$1.call(NativeGitOperationHelper.java:491)	at com.atlassian.bamboo.plugins.git.CallableResultCache$1.load(CallableResultCache.java:29)	at com.atlassian.bamboo.plugins.git.CallableResultCache$1.load(CallableResultCache.java:25)	at com.google.common.cache.CustomConcurrentHashMap$ComputingValueReference.compute(CustomConcurrentHashMap.java:3426)	at com.google.common.cache.CustomConcurrentHashMap$Segment.compute(CustomConcurrentHashMap.java:2322)	at com.google.common.cache.CustomConcurrentHashMap$Segment.getOrCompute(CustomConcurrentHashMap.java:2291)	at com.google.common.cache.CustomConcurrentHashMap.getOrCompute(CustomConcurrentHashMap.java:3802)	at com.google.common.cache.ComputingCache.get(ComputingCache.java:46)	at com.google.common.cache.AbstractCache.getUnchecked(AbstractCache.java:49)	... 48 more
```

Running the command "/usr/bin/git ls-remote [https://razer.git.cloudforge.com/systems.git"](https://razer.git.cloudforge.com/systems.git%22) in a terminal winow works perfectly fine. I'm pretty sure the cause is something silly that I'm not aware of, but I've been searching for hours and have yet to find and answer. Can anyone help?


Answers:
author: Greta Chang
body: I managed to get things working on a different machine with the same setup. Not sure what exactly caused the problem, but I can at least just use that for now and get on with learning to use Bamboo. If anyone does know what the problem was, I'd still love to know.


author: Przemyslaw Bureta
body: I had the same problem I had been trying to connect to Bitbucket repository.

It was caused by default server capabilities.

I had to add a Git Executable for SSH.

image2015-2-10 17:3:35.png

and then add it to build plan.

image2015-2-10 17:5:24.png

Hope you find it useful.  
[](https://community.atlassian.com/t5/Bamboo-questions/Bamboo-Git-authentication-fails/qaq-p/329703?attachment-id=5142){#link_116b17b1943b49}  
[](/tnckb94959/attachments/tnckb94959/bamboo-questions/10405/1/image2015-2-10%2017%3A2%3A36.png){#display_116b17b1943b49_0}  
[](https://community.atlassian.com/t5/Bamboo-questions/Bamboo-Git-authentication-fails/qaq-p/329703?attachment-id=5143){#link_116b17b1943b49_0}  
[](/tnckb94959/attachments/tnckb94959/bamboo-questions/10405/2/image2015-2-10%2017%3A3%3A35.png){#display_116b17b1943b49_2}  
[](https://community.atlassian.com/t5/Bamboo-questions/Bamboo-Git-authentication-fails/qaq-p/329703?attachment-id=5144){#link_116b17b1943b49_1}  
[](/tnckb94959/attachments/tnckb94959/bamboo-questions/10405/3/image2015-2-10%2017%3A5%3A24.png){#display_116b17b1943b49_4}


author: rsperafico
body: Hi Guys,

If you are planning on using SSH keys, please make sure they have been added to your ssh keys.

Use the following command to list your ssh keys in the terminal:

**ssh-add -l**

Use the following command to add an ssh key in the terminal:

**ssh-add \<path to your ssh private key\>**

Once you have done that, please add your credentials to "**Shared credentials** " under "**Bamboo Administration** " \>\> "**Shared repositories** " \>\> "**Shared credentials** " and add the credentials. Please remember you have to add a **SSH private key** and **its password** in there.

As well as that, you can add a "**Shared repository** " under "**Bamboo Administration** " \>\> "**Shared repositories** " and select "**Authentication Type** " as "**Shared credentials**".

---

Kind regards,

Rafael


author: pradhyumna shrestha
body: Please try this in the remote-agent and the server

git config --global http.sslVerify false


author: Vandan Phadke
body: I am having the same issue. I even changes the global configurations of git for the bamboo server machine to match to that of the repository's credentials


author: john livingston
body: I hit an authentication issue with Git attempting to run my first bamboo project-plan. Among other text, the authentication error included:

ssh://sysadmin@stash.com:7999/\<proj\>/\<repo\>.git failed with code 128.

For me, the problem was "Shared credentials" were not yet configured in bamboo so, apparently, the connection to stash was attempted with bamboo's current user/admin credentials (sysadmin) and that was failing.

The lack of shared credentials was not immediately apparent to me as the shared credentials page 'helps' by partially filling the form for you. Revisiting that page led me to believe 'yes. bamboo has autogenerated a credential to talk to stash for me.'

Eventually I realized shared credentials had not been configured and I filled in the display name/ssh key fields. The display name was an actual user name. The ssh key came from the user's \~/.ssh/id_rsa file contents.

comments: author: James Dumay
body: You might want to try Bamboo 5.5. We automatically figure out authentication for Stash when you have an app link.

<https://confluence.atlassian.com/display/BAMBOO/Bamboo+5.5+Release+Notes>


author: john livingston
body: Yes! Thank You. Updated this morning.


author: Melinda Moran
body: Same problem, I first tried authenticating with userID/password to the repository, and it worked fine. Then tried to use the SSH key authentication and got this error:

```
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: com.atlassian.bamboo.plugins.git.GitCommandException: command /usr/bin/git ls-remote git://bitbucket.org/jmhebiz-ondemand/webrequest.git failed with code 128. Working directory was [.]., stderr:[bitbucket.org[0: 131.103.20.167]: errno=Connection timed out, bitbucket.org[0: 131.103.20.168]: errno=Connection timed out, fatal: unable to connect a socket (Connection timed out)]
```

Then later on I again ensured I had my SSH key setup in my BitBucket repository, and same problem.

Later on in the day, I tried one more time, and all worked. Maybe BitBucket was having some problems, OR I needed to wait for some period of time for the SSH public key to be recognized to the system?


author: Manykutty Joy
body: Using ssh-keys based authentication solved the issue for me.


author: Manykutty Joy
body: Having exactly the same issue!!


Tags: git