title: Commit via C# code - git
body: <p>I written .net core 2.0 web application. In My application I use git library: "LibGit2Sharp"</p>
  
  <p>I have problem with commit - my application get request from external service and must get data via rest request after that create files and create commit added files. In Crone (5 minutes) I push data to git server.</p>
  
  <p>If application have to many request git stop working... and I lost whole history (all files in git repo). (I save commit Id to get diff after)</p>
  
  <p>My commit code:
  </p>
  
  <pre><code>if (flagHtml)
      Commands.Stage(repo, fileName + ".html");
  
  if (flagDisplay)
      Commands.Stage(repo, fileName + ".json");
  
  var author = new Signature(notification.userName, $"{notification.userName}@test.test", DateTime.Now);
  var commit = repo.Commit($"Update asset: {notification.assetId} by {notification.userName}.", author, author, new CommitOptions { AllowEmptyCommit = true });
  </code></pre>
  
  <p>I calling this method in Mutex. Only one way to fix it what I find was type Sleep 1 second after commit (inside mutex). So It have time to process before next commit will come.</p>
  
  <p>But I afraid it is wrong idea to do this because if I will get bigger file 1 second can be not enough.</p>