1

我使用 aws codecommit 作为 repoconfig-repo

我在连接到 git(codecommit) 后端时遇到了间歇性问题。

当我尝试使用 Git 凭证连接时,它可以工作,但不能使用 IAM 访问权限和密钥。它说git upload pack not permitted

但有一段时间它适用于 IAM 访问和密钥,而不适用于 Git 凭证,反之亦然。

错误日志

Caused by: org.eclipse.jgit.errors.TransportException: https://git-codecommit.<region>.amazonaws.com/v1/repos/<my-repo>: 
git-upload-pack not permitted on 'https://git-codecommit.<region>.amazonaws.com/v1/repos/<my-repo>/'

根据官方文档,它说

如果您通过 AWS CodeCommit URI 提供用户名和密码,则它们必须是提供对存储库的访问权限的 AWS accessKeyId 和 secretAccessKey。如果您未指定用户名和密码,则使用 AWS 默认凭证提供程序链检索 accessKeyId 和 secretAccessKey。

应用程序.yml

spring:
  profiles: dev
  cloud:
    config:
      server:
        encrypt.enabled: false
        git:
          # Https
          uri: https://git-codecommit.<region>.amazonaws.com/v1/repos/<my-repo>
          force-pull: true
          clone-on-start: true
          default-label: master
          searchPaths: dev, stag, prod
          # ---- IAM Access/secret ----
          #username: 'AKI***************O6'
          #password: 'Fz+*************************csJQ'
          # ---- Git credentials ----
          username: '<my-repo>-at-18*********72'
          password: '0Z0X*****************************bUB5w='

  autoconfigure:
    exclude: org.springframework.cloud.aws.autoconfigure.context.ContextStackAutoConfiguration

我能够使用它们中的任何一个运行该应用程序,但它同时停止工作,我无法弄清楚它为什么不能使用 IAM 凭证的原因。

依赖版本

  • 弹簧引导启动器父:2.3.2.RELEASE
  • 弹簧云依赖项:Hoxton.SR7
  • 弹簧云配置:2.2.4.RELEASE
4

0 回答 0