Listen for git push event from plugin in 2019.2


In this post a colleague of mine asked the question how to listen for push events in an Intellij Plugin.

The answer worked for us until Intellij version 2019.2 came around. In that version, the class GitPushProcessCustomization was removed (in this commit).

Is there now another way to react to the results of a push or is it no longer possible?


There is direct API to listen for Push, however, this can be achieved with some heuristic.

One can listen for GIT_AUTHENTICATION_SUCCESS to know when any remote operation (pull, push or fetch) completes successfully.

Then, to make sure it was actually a push, one can use git4idea.branch.GitBranchIncomingOutgoingManager#hasIncomingFor. It should be true before the operation and false after it.


Thanks for your help, the listener works.

But I dont quite get the check for a push to work. For example if I push and then fetch, hasIncomingFor also returns false for the fetch.

Is there any other way to get that information?


Sorry, my bad, you should check `hasOutgoingFor`, not `hasIncomingFor`, of course. Push is about transferring commits from the local repo after all.

Also, see


I'm sorry, but I still dont really get it to work (probably because I dont really know how this should work).

Am I correct and the hasOutgoingFor basically checks if this small green arrow is next to the branch in the branch dropdown?

If thats true, then I think it should work to test the state before and after the push, but how do I do that. As far as I can see it, the listener is only called before (?) the actual push, at least at that point hasOutgoingFor returns true. But how would I make the check after the operation?


why my program is error

2022-05-24 20:40:07,112 [ 453727]  ERROR - intellij.openapi.progress.Task - object is not an instance of declaring class 
java.lang.IllegalArgumentException: object is not an instance of declaring class
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(
    at java.base/java.lang.reflect.Method.invoke(
    at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(
    at com.intellij.util.messages.impl.MessageBusImpl.deliverMessage(
    at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(
    at com.intellij.util.messages.impl.MessageBusImpl.access$100(
    at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(
    at com.sun.proxy.$Proxy173.authenticationSucceeded(Unknown Source)
    at git4idea.push.GitPushOperation.doPush(
    at git4idea.push.GitPushOperation.push(
    at git4idea.push.GitPushOperation.execute(
    at git4idea.push.GitPusher.pushAndNotify(
    at git4idea.push.GitPusher.push(
    at com.intellij.dvcs.push.PushController.doPushSynchronously(
    at com.intellij.dvcs.push.PushController.push(
    at com.intellij.dvcs.push.ui.VcsPushDialog$
    at com.intellij.openapi.progress.impl.CoreProgressManager$
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(
    at java.base/java.util.concurrent.CompletableFuture$
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(
    at java.base/java.util.concurrent.ThreadPoolExecutor$
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$
    at java.base/ Method)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$
    at java.base/
2022-05-24 20:40:07,113 [ 453728]  ERROR - intellij.openapi.progress.Task - IntelliJ IDEA 2020.3.1  Build #IU-203.6682.168 
2022-05-24 20:40:07,116 [ 453731]  ERROR - intellij.openapi.progress.Task - JDK: 11; VM: OpenJDK 64-Bit Server VM; Vendor: Oracle Corporation 
2022-05-24 20:40:07,116 [ 453731]  ERROR - intellij.openapi.progress.Task - OS: Windows 10 
2022-05-24 20:40:07,117 [ 453732]  ERROR - intellij.openapi.progress.Task - Last Action: CheckinProject 
2022-05-24 20:40:07,555 [ 454170]   WARN - arketplace.MarketplaceRequests - Can not get JetBrains plugins' IDs from Marketplace:Received fatal alert: handshake_failure 

>why my program is error

Hard to tell without any relevant source code, but likely an incorrectly registered GitAuthenticationListener.


Please sign in to leave a comment.