trouble cloning a module from a remote git repository
Asked by Roger Day:

Tried to add a linked repository to Bamboo, where the git repository is on another machine.

Other remote repositories on the same bamboo server work.

The real URL is

ssh://git@bitbucket.renalregistry.nhs.uk:7999/inf/housekeeping.git

And I get these errors:

Unable to detect changes  
(com.atlassian.bamboo.plugins.git.GitCommandException : command 'C:\\Program Files (x86)\\Git\\cmd\\git.exe' ls-remote ssh://9447c727-f065-4b1f-985c-c0c037ea4e96@127.0.0.1:49266/inf/housekeeping.git failed with code 128. Working directory was \[.\]., stderr: Warning: Permanently added '\[127.0.0.1\]:49266' (RSA) to the list of known hosts. Repository not found The requested repository does not exist, or you do not have permission to access it. fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.)

<br />

Occurred: 26 Jul 2017, 2:58:50 PM

*** ** * ** ***

```
com.atlassian.bamboo.plugins.git.GitCommandException: command 'C:\Program Files (x86)\Git\cmd\git.exe' ls-remote ssh://9447c727-f065-4b1f-985c-c0c037ea4e96@127.0.0.1:49266/inf/housekeeping.git failed with code 128. Working directory was [.]., stderr:Warning: Permanently added '[127.0.0.1]:49266' (RSA) to the list of known hosts.Repository not foundThe requested repository does not exist, or you do not have permission to access it.fatal: Could not read from remote repository.Please make sure you have the correct access rightsand the repository exists.	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:720)	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:508)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.lambda$getRemoteRefs$0(NativeGitOperationHelper.java:628)	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:639)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:576)	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:682)	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.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:559)	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.lambda$createBuildRepositoryChanges$0(DefaultChangeDetectionManager.java:440)	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.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)
```

TIA


Answers:
author: somethingblue
body: Hi Roger,

You stated The other remote repos on the same server work.

* Are they on the same Bitbucket host?
* Are there any permissions/restrictions set on the Bitbucket repository?

This could really be any sort of connection error between Bamboo and Bitbucket Server. I would try running the git command manually from the Bamboo server to see if the error appears there as well.

Cheers,

Branden

comments: author: Roger Day
body: They're on the same bitbucket host.

No restrictions set.

I'm using the same public key credentials across all the components.

I've used git from bamboo server to checkout the code onto the server. (but not using the above c/l, just a standard git clone)

The original repositories had their git origins reset in a task in the Bamboo build scripts.

(This new repo is supposed to be a secondary module containing housekeeping scripts which the original ones will use. It should only ever be cloned and used.)

Regards, Roger


author: Roger Day
body: The problem was the chaotic mismanagement of access keys, which I have solved.

Regards, Roger.