Please help me with git4idea integration

Hi all,

I am working to build my first Intellij plugin, but I encountered a problem. My apologizes if my question is already replied or is stupid.

I am trying to get Git branch name and for this I am did something like:

Git git = new GitImpl();
GitLineHandler gitLineHandler = new GitLineHandler(project, virtualFile, GitCommand.BRANCH;);
GitCommandResult gitCommandResult = git.runRemoteCommand(new Computable.PredefinedValueComputable(gitLineHandler));

Unfortunately, I receive an error:
java.lang.ClassCastException: git4idea.config.GitVcsApplicationSettings cannot be cast to git4idea.config.GitVcsApplicationSettings
    at git4idea.config.GitVcsApplicationSettings.getInstance(
    at git4idea.commands.GitHandler.<init>(
    at git4idea.commands.GitHandler.<init>(
    at git4idea.commands.GitTextHandler.<init>(
    at git4idea.commands.GitLineHandler.<init>(

Intellij version: 14.1.3 Community
OS: Rhel 5
In order to get git4idea.jar, I copied it from the location where I have Intellij Community sources/plugins/git4idea/lib/*.jar in the location where I have installed Intellij/plugins/git4idea/lib/*

Any suggestion is more than welcome!

Thanks in advance!

1 comment
Comment actions Permalink

You need to add the libraries of the Git plugin to the classpath of your IntelliJ IDEA SDK, rather than copy them under your project.


Please sign in to leave a comment.