Bamboo - StashRepositoryException, GitCommandException
Asked by Peddareddy Biyyam:

I'm seeing these type of errors in my Bamboo UI, apparantly there's no issue in my daily tasks but these errors' count is growing day by day. I googled for a fix, but nothing seems to be the right fix. Please help.

com.atlassian.bamboo.plugins.stash.repository.StashRepositoryException: com.atlassian.bamboo.plugins.git.GitCommandException: command /bin/git ls-remote ssh://09750e53-002d-46f0-9d9b-fa353b8862a1@127.0.0.1:41453/sum/assets.git failed with code 128. Working directory was \[.\]., stderr:  
Warning: Permanently added '\[127.0.0.1\]:41453' (RSA) to the list of known hosts.  
Permission denied (password).  
fatal: Could not read from remote repository.  
Please make sure you have the correct access rights  
and the repository exists.  
at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerChangeDetector.collectChangesSinceRevision(BitbucketServerChangeDetector.java:37)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:559)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.lambda$createBuildRepositoryChanges$0(DefaultChangeDetectionManager.java:440)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$$Lambda$187/977818346.call(Unknown Source)  
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:221)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:385)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:310)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:193)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildIfTriggered(DefaultChangeDetectionManager.java:131)  
at com.atlassian.bamboo.v2.trigger.ChangeDetectionListenerAction.testIfBuildShouldStart(ChangeDetectionListenerAction.java:114)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$3.call(PlanExecutionManagerImpl.java:509)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$3.call(PlanExecutionManagerImpl.java:492)  
at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)  
at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:85)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:783)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.startConditionalBuild(PlanExecutionManagerImpl.java:491)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.start(PlanExecutionManagerImpl.java:565)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.start(PlanExecutionManagerImpl.java:582)  
at com.atlassian.bamboo.plan.DelegatingPlanExecutionManager.start(DelegatingPlanExecutionManager.java:95)  
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$4.startPlanExecution(NonBlockingPlanExecutionServiceImpl.java:234)  
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$4.lambda$call$0(NonBlockingPlanExecutionServiceImpl.java:220)  
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$4$$Lambda$171/903831408.run(Unknown Source)  
at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:159)  
at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:155)  
at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:188)  
at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:154)  
at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:219)  
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$4.call(NonBlockingPlanExecutionServiceImpl.java:219)  
at com.atlassian.bamboo.plan.NonBlockingPlanExecutionServiceImpl$4.call(NonBlockingPlanExecutionServiceImpl.java:202)  
at java.util.concurrent.FutureTask.run(FutureTask.java:266)  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)  
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:51)  
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:31)  
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:20)  
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52)  
at java.lang.Thread.run(Thread.java:745)  
Caused by: com.atlassian.bamboo.plugins.git.GitCommandException: command /bin/git ls-remote ssh://09750e53-002d-46f0-9d9b-fa353b8862a1@127.0.0.1:41453/sum/assets.git failed with code 128. Working directory was \[.\]., stderr:  
Warning: Permanently added '\[127.0.0.1\]:41453' (RSA) to the list of known hosts.  
Permission denied (password).  
fatal: Could not read from remote repository.  
Please make sure you have the correct access rights  
and the repository exists.  
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:671)  
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:482)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.lambda$getRemoteRefs$0(NativeGitOperationHelper.java:573)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper$$Lambda$198/110289277.call(Unknown Source)  
at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:43)  
at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:38)  
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)  
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)  
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)  
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)  
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)  
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)  
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)  
at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.get(AlwaysInvalidatingCacheDecorator.java:71)  
at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:145)  
at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:164)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:584)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:522)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:626)  
at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChanges(GitChangeDetector.java:74)  
at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChangesSinceRevision(GitChangeDetector.java:50)  
at com.atlassian.bamboo.plugins.stash.v2.BitbucketServerChangeDetector.collectChangesSinceRevision(BitbucketServerChangeDetector.java:29)  
... 36 more


Answers:
author: Alexey Chystoprudov
body: It looks like <https://jira.atlassian.com/browse/BAM-18117>, which was fixed in v5.15


author: Jobin Kuruvilla [Adaptavist]
body: There might some liked repositories in your Bamboo that is failing authentication to Bitbucket.

Also, check for failing builds. Maybe there are some builds that you do not have access to?