Fixing a race condition while installing git gems with multiple jobs

Fixes the issue #3174