I want to push files from a folder on Azure App Service to a Git repository.
I have copied the local git repo up to the server and I'm using LibGit2Sharp to commit and push these files:
using (var repo = new Repository(@"D:\home\site\wwwroot\repo"))
{
    // Stage the file
    Commands.Stage(repo, "*");
    // Create the committer's signature and commit
    Signature author = new Signature("translator", "example.com", DateTime.Now);
    Signature committer = author;
    // Commit to the repository
    Commit commit = repo.Commit($"Files updated {DateTime.Now}", author, committer);
    Remote remote = repo.Network.Remotes["origin"];
    var options = new PushOptions
    {
        CredentialsProvider = (_url, _user, _cred) =>
            new UsernamePasswordCredentials
            {
                Username = _settings.UserName,
                Password = _settings.Password
            }
    };
    repo.Network.Push(remote, @"+refs/heads/master", options);
}
It works, but seems to take a while and and this seems a bit clunky. Is there a more efficient way to achieve this via code, or perhaps directly via Azure (config or Azure Functions)?
 
     
    