Search code examples
c#githuboctokit

How to Download Directory from Github


hi i want to download a directory from github account how can i do this? for example i want to download manifest folder from test acount:

github.com/test/projectx/manifest

I don't want to use github API as much as possible but I tested Octokit It's like taking the folder as a byte, but I couldn't turn it into a folder on my system

 var archiveBytes = await client.Repository.Content.GetArchive("octokit", "octokit.net", ArchiveFormat.Zipball);

Solution

  • If you are looking for a way to clone repository to your local machine you can do as follow.

    You will want to use LibGit2Sharp library, You can install it using:

    NuGet Package Manager (Visual Studio) NuGet link

    Install-Package LibGit2Sharp
    

    -or-

    .NET Core CLI

    dotnet add package LibGit2Sharp
    

    Then simply use:

    Repository.Clone("https://github.com/EdiWang/EnvSetup.git", @"D:\EnvSetup");
    

    For more details see: Operate git with net core