I switched from using JGit to native Git support. As recommended here:
Unfortunate my configured AWS CodeCommit repositories don't work anymore.
2021-08-20 10:21:43,917 INFO [http-nio-8085-exec-20] [RepositoryResource] Testing connection to repository (type: Git, location: https://git-codecommit.eu-cen
tral-1.amazonaws.com/v1/repos/bamboo-test)
2021-08-20 10:21:44,013 INFO [http-nio-8085-exec-20] [RepositoryResource] Failed to connect to repository (type: Git, location: https://git-codecommit.eu-cent
ral-1.amazonaws.com/v1/repos/bamboo-test, time: 95.63 ms, errors: [fatal: unable to access 'https://git-codecommit.eu-central-1.amazonaws.com/v1/repos/bamboo-
test/': The requested URL returned error: 403])
The problem looks like an issue described here two years ago.