Fixes #3531,#3899: Backport the GIT lock nuking promise from 2.5

Ticket: http://www.rudder-project.org/redmine/issues/3899

To be merged in 2.4