GIT source code repository authentication / access
Asked by Lars Denkewitz:

Hello, I can not access our GIT Bitbucket (Cloud) repository.

Application link is added. HTTP(S) proxy settings are added in tomcat config.

Here the set-up:  
- Azure Windows Datacenter 2016  
- IIS 10 as proxy (hostname(DNS) -\> localhost:8085 which is the tomcat)

Before I installed Bamboo 6.0 with the same GIT credentials: simple authentication via username / password combination. For the password I use an Application Password, set-up in Bitbucket. This setting works.  
Yesterday I installed a new Bamboo 6.5 and imported the previous setting. GIT authentication fails since then.

Here my findings:

Following the below error message, it seems Bamboo generates a tmp-file (of unknown content) probably based on the authentication settings, given in the Bamboo configuration. It is then calling the "**ls-remote** " command with the credential-helper parameters "**-c credential.helper= -c 'credential.helper=store --file=F:/Program Files/Bamboo/temp/gitCredentials4884503143678724128.tmp'** ". These credentials might not contain the correct ones and the authentication fails.  
I re-tried this call (with empty test-file) via GIT-bash and succeeded, after applying the same credentials as given in Bamboo configuration.  
Also, the credential-helper-manager for Windows is installed and I added the credentials there as well. Calling: "**C:\\Program Files\\Git\\cmd\\git.exe' ls-remote [https://bitbucket.org/*r*](https://bitbucket.org/vitaminstoreonline/vitaminstore-nop)*epository-name*** " succeeds perfectly fine, since "**git config --system**" contains "credential.helper=manager". That means, Bamboo should also make use of the manager by default (fall-back), but somehow doesn't.

**++Please help me finding a solution for this problem.++**

Here the **error log**:

com.atlassian.bamboo.plugins.git.GitCommandException: command \['**C:\\Program Files\\Git\\cmd\\git.exe' -c credential.helper= -c 'credential.helper=store --file=F:/Program Files/Bamboo/temp/gitCredentials4884503143678724128.tmp' ls-remote https://*user* *-name* [@Bitbucket](/t5/user/viewprofilepage/user-id/1253146).org/[*r*](https://bitbucket.org/vitaminstoreonline/vitaminstore-nop)*epository-name*** \] failed with code 128. Working directory was \[F:\\Program Files\\Bamboo\\temp\]., stderr:  
usage: git credential-store \[\<options\>\] \<action\>  
--file \<path\> fetch and store credentials in \<path\>  
remote: Too many invalid password attempts. Log in at <https://id.atlassian.com/> to restore access.  
fatal: unable to access 'https://*user-name* [@Bitbucket](/t5/user/viewprofilepage/user-id/1253146).org/*repository-name* /': The requested URL returned error: 403  
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.runCommand(GitCommandProcessor.java:703)  
at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getRemoteRefs(GitCommandProcessor.java:481)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.lambda$getRemoteRefs$1(NativeGitOperationHelper.java:585)  
at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:38)  
at com.atlassian.bamboo.util.CallableResultCache$1.load(CallableResultCache.java:34)  
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:64)  
at com.atlassian.bamboo.collections.AlwaysInvalidatingCacheDecorator.getUnchecked(AlwaysInvalidatingCacheDecorator.java:125)  
at com.atlassian.bamboo.util.CallableResultCache.call(CallableResultCache.java:141)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.getRemoteRefs(NativeGitOperationHelper.java:593)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.resolveBranch(NativeGitOperationHelper.java:545)  
at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.obtainLatestRevision(NativeGitOperationHelper.java:644)  
at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChanges(GitChangeDetector.java:152)  
at com.atlassian.bamboo.plugins.git.v2.GitChangeDetector.collectChangesSinceRevision(GitChangeDetector.java:71)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:579)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.lambda$createBuildRepositoryChanges$2(DefaultChangeDetectionManager.java:478)  
at com.atlassian.bamboo.variable.CustomVariableContextImpl.withVariableSubstitutor(CustomVariableContextImpl.java:185)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:439)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:291)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:224)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:168)  
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:194)  
at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.performDelayedChangeDetection(ManualBuildDetectionAction.java:154)  
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$1.getChainState(ChainExecutionManagerImpl.java:240)  
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:315)  
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:232)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:498)  
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:197)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)  
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)  
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)  
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212)  
at com.sun.proxy.$Proxy208.delayedStart(Unknown Source)  
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)  
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)  
at java.lang.reflect.Method.invoke(Method.java:498)  
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)  
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:206)  
at com.sun.proxy.$Proxy208.delayedStart(Unknown Source)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.lambda$call$0(PlanExecutionManagerImpl.java:374)  
at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:136)  
at com.atlassian.bamboo.util.CacheAwareness$3.call(CacheAwareness.java:133)  
at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:162)  
at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:133)  
at com.atlassian.bamboo.util.CacheAwareness.withValuesOlderThanTimestampReloaded(CacheAwareness.java:187)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:373)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:366)  
at io.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:293)  
at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:75)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:655)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$400(PlanExecutionManagerImpl.java:130)  
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:362)  
at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)  
at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)  
at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)  
at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)  
at java.lang.Thread.run(Thread.java:748)

Thank you,  
Lars


Answers:
author: Lars Denkewitz
body: Was there any resolution to this issue.

I am on 6.8.0 and still facing this issue.

comments: author: Lars Denkewitz
body: Hi Vijay,

I'm sorry to tell that I can not help with that. After a few rounds with the customer service we unfortunately still couldn't figure out the reason.  
In the end, my team decided to move to a hosted CI solution (cloud).

Cheers


author: Gabriel Ribeiro
body: Hi Lars,

We opened a support ticket to take a closer look. Please watch out for an email from our support portal. When the issue is resolved we can follow up on this thread to let the Community know how.

thanks


author: Gabriel Ribeiro
body: Hello Lars,

Are you running Bamboo as a Windows Service? Is this service starting with a local user account? If not, please make sure to change that following the documentation below and then give read and write permissions to this user in the "F:/Program Files/Bamboo/" directory.

* [Running Bamboo as a Windows service as the local user](https://confluence.atlassian.com/bamboo/running-bamboo-as-a-windows-service-as-the-local-user-416580754.html)

Please let us know the results.

thanks

comments: author: Lars Denkewitz
body: Hey Gabriel,

Thanks for your reply.  
Yes it's running with an admin user and has all those permissions (run as service and write access in file system).  
I also just double-checked win firewall. That is also no issue (inbound/outbound opened for tcp:8085 and concrete program "tomcat.exe").