How do I clone git repo using plugin code.
Answered
Hi,
I'm trying to develop a plugin where source code of a component of project can be automatically cloned and added as a separate module and a dependency to the core module.
I have gone through the below link but found nothing useful to allow me clone the repository.
https://www.jetbrains.org/intellij/sdk/docs/reference_guide/vcs_integration_for_plugins.html
More precisely, how do I perform this operation
GitCheckoutProvider.clone(project, Git.getInstance(), listener, destinationParent, sourceRepositoryURL, directoryName, parentDirectory)
Thanks in Advance.
Please sign in to leave a comment.
The method that you refer to is a static method that you can call from everywhere.
You also have to make sure, that in your Gradle configuration, you've added a dependency to the git4idea plugin:
intellij {// ...
plugins 'java', 'git4idea'
}
Can you provide me with any document on how to use Git API ? As I'm looking not to handle user credentials for my plugin separately.
Git plugin sources are available in JetBrains GitHub repository: https://github.com/JetBrains/intellij-community/tree/master/plugins/git4idea/src/git4idea
Probably you'll be interested in GitHttpGuiAuthenticator class, however, you should check the sources first which have JavaDocs describing most of the plugin functionalities.
I am still getting this same error as before
this is how my gradle file looks like
plugins {
id 'org.jetbrains.intellij' version '0.4.16'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
}
group 'XX'
version '0.1-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
version '2019.3.3'
plugins 'git4idea'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
patchPluginXml {
changeNotes """
Add change notes here.<br>
<em>most HTML tags may be used</em>"""
}
Do you have a Git4Idea plugin dependency set in plugin.xml?
Yeah I had missed that.
I'm having difficulties finding the right class to clone a repository that is authenticated.
`GitHttpGuiAuthenticator` is of no help.
Basically I want this clone method to automatically ask for username and password if required, store it safely and not ask again if the stored pass still works.