GithubHelp home page GithubHelp logo

Auth example about kgit HOT 1 CLOSED

Garf1eldGit avatar Garf1eldGit commented on August 26, 2024
Auth example

from kgit.

Comments (1)

sya-ri avatar sya-ri commented on August 26, 2024

I haven't maintained this library for a long time, so I'm sorry for not replying.


KGit is just a wrapper for JGit basic features, and to do that you need to add the necessary jgit libraries as dependencies.

build.gradle.kts

dependencies {
    implementation("org.eclipse.jgit:org.eclipse.jgit.ssh.jsch:$jgitVersion")
}

Source

/*
 * import com.jcraft.jsch.Session
 * import org.eclipse.jgit.transport.SshTransport
 * import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider
 * import org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory
 * import org.eclipse.jgit.transport.ssh.jsch.OpenSshConfig
 */

val git: KGit = KGit.cloneRepository {
    setURI("ssh://[email protected]:7999/project/reponame.git")
    setBranchesToClone(listOf("refs/heads/develop"))
    setBranch("refs/heads/develop")
    setCredentialsProvider(UsernamePasswordCredentialsProvider("user", "password"))
    setTransportConfigCallback { transport ->
        val sshTransport = transport as? SshTransport
        sshTransport?.sshSessionFactory =
            object : JschConfigSessionFactory() {
                override fun configure(host: OpenSshConfig.Host?, session: Session?) {
                    // do nothing
                }
            }
    }
}

I haven't tried running it, but at least it shouldn't cause any build errors.

from kgit.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.