Получение следующей ошибки при выполнении операций git с API библиотеки j git из приложений java. Это приложение работает на tomcat внутри контейнера docker.
Трассировка стека исключений:
Caused by: org.eclipse.jgit.api.errors.TransportException: https://gitlab.com/xxxxx/testproject.git: git-upload-pack not permitted on 'https://gitlab.com/xxxxx/testproject.git/'
at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:189)
at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:128)
at com.test.vcs.JGitUploadPackTest.testRepoUpdate(JGitUploadPackTest.java:35)
Caused by: org.eclipse.jgit.errors.TransportException: https://gitlab.com/xxxxx/testproject.git: git-upload-pack not permitted on 'https://gitlab.com/xxxxx/testproject.git/'
at org.eclipse.jgit.transport.TransportHttp.connect(TransportHttp.java:545)
at org.eclipse.jgit.transport.TransportHttp.openFetch(TransportHttp.java:359)
at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:167)
... 135 common frames omitted
Примечание: J GIT версия зависимости: 5.7.0.202003110725-r
Действия по воспроизведению проблемы:
public void getRefBranches() throws IOException, GitAPIException {
FileRepositoryBuilder builder = new FileRepositoryBuilder();
Repository repository = builder.readEnvironment().findGitDir(new File("${projectLocation}")).build();
Git git = new Git(repository);
CredentialsProvider credentialProvider = new UsernamePasswordCredentialsProvider("userName", "password");
LsRemoteCommand listRemoteReferences = git.lsRemote();
listRemoteReferences.setCredentialsProvider(credentialProvider);
listRemoteReferences.setRemote("https://gitlab.com/xxxxx/testproject.git/");
listRemoteReferences.setHeads(true);
listRemoteReferences.setTags(false);
Collection<Ref> remoteBranches = listRemoteReferences.call();
}