It's all about the answers!

Ask a question

How to debug validatePush function in git integration

Jim Bomhdia (9256) | asked Apr 08 '15, 3:07 p.m.
I am trying to use the Git integration tool RTC-GIT-Hooks-5.0. I have an Apache webserver that I can push and pull git requests from. I have a WebSphere RTC server with a Git project in it. But when I call validatePush in I get this error:

remote: userId = testuser
remote: 255a446694a048d78de383bd2698a2635f63ab70
remote: e5489f2a5ef172138bd123775d713100cae8653c
remote: refs/heads/master
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ''

The RTC project is setup for Git and I have a Authorized Git Requests. Prior to authorizing I was getting a different error ("User not authorized"). I've added some debug to the

    logToFile("userId = " + userId)
    validatePush(jazzRepoUrl, gitRepoKey, userId, localSha1, remoteSha1, remoteRef, excludeRefs)
    logToFile("Done validating")

From the debugging I can tell that execution stops at/in the validatePush function which comes from rtcprocess.pyc:

from rtcprocess import validatePush

My question is, how can I debug what is happening inside this function? How can I know why the validate fails?

Accepted answer

permanent link
Krishna Kishore (50112) | answered Apr 08 '15, 10:46 p.m.
Check the following:
1) On the RTC server side make sure user with the name "testuser" exists and the user has permissions to push commits.
2) Make sure you are using 3.3.5 version of python. 
3) In the pre-receive hook before calling the validatePush set the environment variable "DEBUG_PYT" to true, this will dump more messages on the console which will help in getting more details.

You can raise a new work item on with the relevant details. 

You can refer to the following articles and for more details on the RTC Git Integration.

Jim Bomhdia selected this answer as the correct answer

Jim Bomhdia commented Apr 09 '15, 7:32 a.m.

Thanks Krishna,

I was able to set the debug flag and get something back from validatePush:

remote: HTTP Error 500: Internal Server Error

I'm not sure what to do with that information yet though.

The user does exist. He has a development lead role and is an administrator. The development lead role has every checkbox checked under permissions.

I'm using Python 3.3.0. I'll try 3.3.5.

Jim Bomhdia commented Apr 09 '15, 7:40 a.m.

Same result with 3.3.5:

remote: refs/heads/master
remote: HTTP Error 500: Internal Server Error
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ''

Jim Bomhdia commented Apr 10 '15, 1:53 p.m.

My problem was being caused by an unrelated change between LDAP and Active Directory. Once that change was complete the integration started to work. The DEBUG_PYT variable was helpful. Also by grepping the http_access.log file in the profile logs folder of WebSphere I was able to determine that the request was reaching jts.

One other answer

permanent link
sam detweiler (12.5k6195201) | answered Apr 08 '15, 3:47 p.m.
 according to searches on the net

you have a pre-receive hook enable on the git repo  server side (pre-receive hook declined)

I'd bet that you are trying a non-fast-forward push and the hook blocks it. If that's the case, simply run git pull --rebase before pushing to rebase your local changes on the newest codebase.

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.