Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » git-upload-pack not permitted when cloning
git-upload-pack not permitted when cloning [message #1780671] Thu, 25 January 2018 15:52 Go to next message
Dave Furrer is currently offline Dave FurrerFriend
Messages: 1
Registered: January 2018
Junior Member
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();
        }
Re: git-upload-pack not permitted when cloning [message #1780776 is a reply to message #1780671] Fri, 26 January 2018 23:37 Go to previous message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 84
Registered: August 2016
Member
Gitlab access tokens must be passed either as a parameter or as a header. See the Gitlab documentation.
Previous Topic:Installation aborts due to jetty
Next Topic:Ssh prompting unexpectedly depending on .ssh/config
Goto Forum:
  


Current Time: Wed Nov 14 21:43:49 GMT 2018

Powered by FUDForum. Page generated in 0.02199 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top