git-upload-pack not permitted when cloning [message #1780671] |
Thu, 25 January 2018 10:52  |
Eclipse User |
|
|
|
I'm writing a java application that will checkout my GitLab repo if it hasn't already, else it will "pull".
When doing the initial checkout I get the error "Caused by: org.eclipse.jgit.errors.TransportException: https://gitlab-ci-token@gitlab.com/dfurrer/cosmotronsBinaries.git: git-upload-pack not permitted on 'https://gitlab-ci-token@gitlab.com/dfurrer/cosmotronsBinaries.git/'"
Here is the basic code I've written. I'm using JGit version "4.10.0.201712302008-r". Any ideas what is going wrong here?
Config conf = ConfigFactory.load();
String accessToken = conf.getString("accessToken");
System.out.println("Access Token: " + accessToken);
File repoDirectory = new File("cosmotronsBinaries");
String uri = "https://gitlab-ci-token:" + accessToken + "@gitlab.com/dfurrer/cosmotronsBinaries.git";
CredentialsProvider cp = new UsernamePasswordCredentialsProvider("PRIVATE-TOKEN", accessToken);
Git git = null;
try {
git = Git.open(repoDirectory);
} catch (RepositoryNotFoundException e) {
try {
System.out.println("New install, cloning git repo");
git = Git.cloneRepository()
.setURI(uri)
.setCredentialsProvider(cp)
.setRemote("origin")
.setBranch("master")
.call();
} catch (GitAPIException ex) {
ex.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
if (git != null) {
System.out.println("Updating git repo");
git.pull();
git.close();
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.04570 seconds