Re-structured main for better error handling
Added libgit2 error messages