I have a user reporting this error message when attempting to push to a repository hosted by stash:
remote: You do not have an authorized access token for the remote resource.
To ssh://git@stash.zzzzzzzzzzzzz.com/xxxx/xxxx.git
! [remote rejected] bugfix/DEV-0000-yyyyy-yyyyyyy-yyyyyyy-yyyyyyyy -> bugfix/DEV-0000-yyyyy-yyyyyyy-yyyyyyy-yyyyyyyy (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@stash.zzzzzzzzzzzzzzzzz.com/xxxx/xxxx.git'
catalina.out lists this exception:
com.atlassian.applinks.api.CredentialsRequiredException: You do not have an authorized access token for the remote resource.
at com.atlassian.applinks.core.auth.oauth.ThreeLeggedOAuthRequestFactoryImpl.retrieveConsumerToken(ThreeLeggedOAuthRequestFactoryImpl.java:93)
at com.atlassian.applinks.core.auth.oauth.ThreeLeggedOAuthRequestFactoryImpl.createRequest(ThreeLeggedOAuthRequestFactoryImpl.java:84)
at com.atlassian.applinks.core.auth.ApplicationLinkRequestFactoryFactoryImpl$AbsoluteURLRequestFactory.createRequest(ApplicationLinkRequestFactoryFactoryImpl.java:201)
at com.teslamotors.stash.logchecker.JiraIssueUtils.getIssuesFromApplicationLink(JiraIssueUtils.java:59)
at com.teslamotors.stash.logchecker.JiraIssueUtils.getJiraQueryJson(JiraIssueUtils.java:112)
at com.teslamotors.stash.logchecker.IssueExistenceResult.populateIssueMovesAndNonexistence(IssueExistenceResult.java:35)
at com.teslamotors.stash.logchecker.CommitLogMessagePreReceiveHook.enforceIssueReferencesOnAllRefs(CommitLogMessagePreReceiveHook.java:118)
at com.teslamotors.stash.logchecker.CommitLogMessagePreReceiveHook.checkRefsForRejection(CommitLogMessagePreReceiveHook.java:164)
at com.teslamotors.stash.logchecker.CommitLogMessagePreReceiveHook.onReceive(CommitLogMessagePreReceiveHook.java:208)
at com.atlassian.stash.internal.hook.repository.PreReceiveRepositoryHookAdapter$1.visit(PreReceiveRepositoryHookAdapter.java:39)
at com.atlassian.stash.internal.hook.repository.PreReceiveRepositoryHookAdapter$1.visit(PreReceiveRepositoryHookAdapter.java:33)
at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$8.doInTransaction(DefaultRepositoryHookService.java:415)
at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$8.doInTransaction(DefaultRepositoryHookService.java:409)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.visitEnabledHooks(DefaultRepositoryHookService.java:409)
at sun.reflect.GeneratedMethodAccessor643.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
at com.atlassian.stash.internal.aop.ProfilingAspect.profileMethod(ProfilingAspect.java:45)
at sun.reflect.GeneratedMethodAccessor133.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
at com.atlassian.stash.internal.aop.ProfilingAspect.profileMethod(ProfilingAspect.java:45)
at sun.reflect.GeneratedMethodAccessor133.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:622)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy210.visitEnabledHooks(Unknown Source)
at com.atlassian.stash.internal.hook.repository.PreReceiveRepositoryHookAdapter.onReceive(PreReceiveRepositoryHookAdapter.java:33)
at com.atlassian.stash.internal.hook.DefaultBuiltInHookHandlerFactory$1.handle(DefaultBuiltInHookHandlerFactory.java:57)
at com.atlassian.stash.internal.hook.DefaultHookService.doHandleRequest(DefaultHookService.java:356)
at com.atlassian.stash.internal.hook.DefaultHookService.handleRequest(DefaultHookService.java:342)
at com.atlassian.stash.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:253)
at com.atlassian.stash.internal.hook.DefaultHookService$2$1.run(DefaultHookService.java:213)
at com.atlassian.stash.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:69)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:701)
Since this appears to be related to Jira integration, I had the user remove Jira from authorized applications on his account and re-add it by clicking an issue tag in an older commit. After that, he was able to push fine.
Nothing had changed before this problem started occuring, and the user was able to push successfully before.
Is this a known issue? Is there a way to solve this problem without removing/adding the authorization?