Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git-upload-pack not permitted using JGIT

Tags:

gitlab

jgit

My intent here is to use a "Personal Access Token" to be able to clone/pull from this repo (GitLab) in a java application. I just can't figure out how to get around this error.

Here is the code I have.

    String accessToken = conf.getString("accessToken");

    String uri = "https://gitlab-ci-token:" + accessToken + "@gitlab.com/dfurrer/cosmotronsBinaries.git";

    CredentialsProvider cp = new UsernamePasswordCredentialsProvider("PRIVATE-TOKEN", accessToken);
    git = Git.cloneRepository()
                    .setURI(uri)
                    .setCredentialsProvider(cp)
                    .setRemote("origin")
                    .setBranch("master")
                    .call();

I get his exception:

org.eclipse.jgit.api.errors.TransportException: https://[email protected]/dfurrer/cosmotronsBinaries.git: git-upload-pack not permitted on 'https://[email protected]/dfurrer/cosmotronsBinaries.git/'
like image 537
Dave F Avatar asked Oct 14 '25 16:10

Dave F


1 Answers

I figured out the issue. I was creating a personal access key with read_user and read_registry only. Once I created a token with api permissions I'm able to clone.

like image 152
Dave F Avatar answered Oct 17 '25 06:10

Dave F



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!