Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

BUG REPORT: Native Git Plugin should not throw NPE when SSH_ASKPASS var is not set

I currently have the starter license so I am not allowed to submit this to support and I am not allowed to post this issue to the Bamboo JIRA project either so I am posting it here. 


As we know, the default JGit is buggy, so it is better to use a native git install by adding an appropriate capability. However, if you enable a native git capability where your system has the following conditions, you will get an NPE:

  1. The `SSH_ASKPASS` environment variable is not set
  2. `/usr/echo` and `/usr/bin/echo` do not exist

It is not a safe assumption that if you are not in a windows environment that `/usr/echo` or `/usr/bin/echo` exists. For example I am using a nixos install, and `echo` in my environment exists at `/run/current-system/sw/bin/echo`. 


My workaround is to set `SSH_ASKPASS` to `/run/current-system/sw/bin/echo`.

1 answer

Hi @Asa Riley,

Thanks for reaching out to us!

When Bamboo uses native Git, it simply calls the git executable that you have defined. If `SSH_ASKPASS` is not set, Git should try to send a prompt to the terminal to ask for password input, which appears to be where "echo" comes in.

Can you please paste the NullPointerException stack trace that you receive so we can review it further? This will help us see if we can resolve it here, or if we should file a bug report in the JIRA project.

Without that, I can only give a few suggestions here:

Since, by default, on most linux distributions, `/bin` and `/usr/bin` are already in the PATH, one thing to check could be whether `/run/current-system/sw/bin` is included in the PATH environment variable for the user that runs Bamboo. This should allow Git (and Bamboo) to call it.

Alternatively, you could set `core.askpass` in your git config as follows:

git config --global core.askpass /run/current-system/sw/bin/echo

 Thank you!

Elias | Bamboo Support

Thanks for the response Elias. 

`/run/current-system/sw/bin` is included in the PATH for the user that runs bamboo but it seems that bamboo does not check the PATH for `echo`. It only checks those two specific locations. 

Here is the stack trace:

2018-06-26 16:48:42,811 ERROR [12-BranchDetectionBackgroundThread:pool-19-thread-2] [BranchDetectionServiceImpl] Repository error while detecting branches for plan JC-PR. java.lang.NullPointerException
com.atlassian.bamboo.repository.RepositoryException: java.lang.NullPointerException
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getGitVersion(
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.<init>(
at com.atlassian.bamboo.plugins.git.GitOperationHelperFactory.createGitOperationHelper(
at com.atlassian.bamboo.plugins.git.v2.GitBranchDetector.getOpenBranches(
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.getOpenBranchesCaller(
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.lambda$load$0(
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.load(
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl$2.load(
at com.atlassian.bamboo.repository.RepositoryCachingFacadeImpl.getOpenBranches(
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl.lambda$getOpenBranches$4(
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl.getOpenBranches(
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl.createNewBranchesForChainNoLock(
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl$BranchDetector$1.lambda$run$0(
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(
at org.springframework.orm.hibernate5.HibernateTemplate.execute(
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl$BranchDetector$
at com.atlassian.bamboo.plugin.BambooPluginUtils$
at com.atlassian.bamboo.plugin.BambooPluginUtils$
at com.atlassian.bamboo.plugin.BambooPluginUtils.callUnsafeCode(
at com.atlassian.bamboo.plan.branch.BranchDetectionServiceImpl$
at com.atlassian.bamboo.utils.BambooRunnables$
Caused by: java.lang.NullPointerException
at java.lang.ProcessEnvironment.validateValue(
at java.lang.ProcessEnvironment.access$400(
at java.lang.ProcessEnvironment$Value.valueOf(
at java.lang.ProcessEnvironment$StringEnvironment.put(
at java.lang.ProcessEnvironment$StringEnvironment.put(
at java.util.AbstractMap.putAll(
at com.atlassian.utils.process.ExternalProcessImpl.createDefaultProcess(
at com.atlassian.utils.process.ExternalProcessImpl.createProcess(
at com.atlassian.utils.process.ExternalProcessImpl.start(
at com.atlassian.utils.process.ExternalProcessImpl.execute(
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(
at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(
at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getGitVersion(
... 36 more

Hey @Asa Riley,

Thanks for sending that.

Before setting SSH_ASKPASS, did Git commands work from the Bamboo server command line, as the user running Bamboo? If this does not work, then it looks like SSH_ASKPASS needs to be set explicitly in NixOS.

In the one previous support ticket where this was raised, the solution was the same as you workaround. The difference was that the other ticket was running inside a chroot – does your NixOS install use a similarly changed root? 

Thank you in advance for you answer to this question. It will help me prepare documentation, and likely a bug report, on this issue.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo Data Center 8.1 is now available

G’day Bamboo customers, Bamboo DC 8.1 is now available with it the following features and programs: SAML 2.0, OpenID Connect, and Crowd SSO In order to help admins with a simplified user manage...

213 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you