¿Cómo puedo crear un "cliente Github" con Octokit.Net en C #?

Uso la herramienta Octokit.net para hacer un cliente propio de GitHub y mi pregunta es ¿cómo puedo eliminar los files en el repository cuando ya no están en la carpeta local?

Este es el código que ya tengo:

using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Reactive.Linq; using System.IO; using Octokit; using Octokit.Internal; using Octokit.Reactive; class Program { static void Main(string[] args) { MainAsync(args[0], args[1], args[2], args[3]).Wait(); } static async Task MainAsync(string rootPath, string owner, string repo, string branch) { var github = new GitHubClient(new ProductHeaderValue("repository")); var user = await github.User.Get("username"); github.Cnetworkingentials = new Cnetworkingentials("token"); var contents = await github.Repository.Content.GetAllContents(owner, repo); foreach(var githubFilePath in contents) { Console.WriteLine(githubFilePath); } Console.WriteLine(contents); UpdateFull().Wait(); // Update a whole folder async Task UpdateFull() { updateGithub(rootPath).Wait(); async Task updateGithub(string path) { var localContents = Directory.GetFiles(path); var localContentFolders = Directory.GetDirectories(path); var headMasterRef = "heads/master"; var masterReference = await github.Git.Reference.Get(owner, repo, headMasterRef); var latestCommit = await github.Git.Commit.Get(owner, repo, masterReference.Object.Sha); var nt = new NewTree { BaseTree = latestCommit.Tree.Sha }; // Add items based on blobs AddDirectoryToTree(path, path + "\\", nt).Wait(); var rootTree = await github.Git.Tree.Create(owner, repo, nt); // Create Commit var newCommit = new NewCommit("Commit test with several files", rootTree.Sha, masterReference.Object.Sha); var commit = await github.Git.Commit.Create(owner, repo, newCommit); await github.Git.Reference.Update(owner, repo, headMasterRef, new ReferenceUpdate(commit.Sha)); } async Task AddDirectoryToTree(string DirectoryPath, string RootPath, NewTree Tree) { // all direct files in the folder // var localContents = Directory.GetFiles(DirectoryPath); foreach (var filePath in localContents) { string sExtension = Path.GetExtension(filePath).ToUpper(); string sFilename = filePath.Replace(RootPath, "").Replace(@"\", "/"); Console.WriteLine("File(Local): " + sFilename); switch (sExtension) { default: // Create text blob var textBlob = new NewBlob { Encoding = EncodingType.Utf8, Content = File.ReadAllText(filePath) }; var textBlobRef = await github.Git.Blob.Create(owner, repo, textBlob); Tree.Tree.Add(new NewTreeItem { Path = sFilename, Mode = "100644", Type = TreeType.Blob, Sha = textBlobRef.Sha }); break; case ".PNG": case ".JPEG": case ".JPG": // For image, get image content and convert it to base64 var imgBase64 = Convert.ToBase64String(File.ReadAllBytes(filePath)); // Create image blob var imgBlob = new NewBlob { Encoding = EncodingType.Base64, Content = (imgBase64) }; var imgBlobRef = await github.Git.Blob.Create(owner, repo, imgBlob); Tree.Tree.Add(new NewTreeItem { Path = sFilename, Mode = "100644", Type = TreeType.Blob, Sha = imgBlobRef.Sha }); break; } } // subfolder // var localContentFolders = Directory.GetDirectories(DirectoryPath); foreach (string subDirPath in localContentFolders) { AddDirectoryToTree(subDirPath, RootPath, Tree).Wait(); } } } Console.WriteLine("-----------------------------------"); Console.WriteLine("Successfully commited Files"); Console.ReadKey(); 

¿Es posible que necesite agregar un nuevo foreach para el repository de Github y hacer una statement if para ver el repository y la carpeta local? : o

¡Les agradecería si pudieran ayudarme con eso! :RE