Fixed possible crash in libgit2 by adding a mutex