Backported fixe for #834 hooks error on remote pulling