Uploaded image for project: 'Git API'
  1. Git API
  2. GIT-6

Add ability to git clone repositories using basic authentication

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 9.9
    • 9.8
    • None
    • Unknown
    • N/A

    Description

      When trying to clone a non-public repository, a JGit TransportException is thrown. Since the cloning is actually done in the GitManager, there's no way to add authentication manually. JGit is expecting some CredentialsProvider.

      I see two possible solutions:

      1. Add an overridden getRepository method, that accepts a CredentialsProvider as third argument. In that case the code of the DefaultGitManager should be changed a bit:
                        // Step 2.1: Need to clone the remote repository since it doesn't exist
                        git.cloneRepository()
                            .setDirectory(localDirectory)
                            .setURI(repositoryURI)
                            .setCredentialsProvider(credentialsProvider)   // this line should be added
                            .call();
          
      2. Split up the getRepository method and expose a method getLocalGitDirectory, in that case you can choose in a script to only use the getLocalGitDirectory method and do the actual clone yourself. This is probably a more complex change, but it gives more flexibility.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            bkummel Bart Kummel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: