kestrel
(net5.0-windows
) is configured to serve static files and allow directory browsing for a non-bare git repository:
services.AddDirectoryBrowser();
var requestPath = "";
var fileProvider = new PhysicalFileProvider(@"D:\MyGitRepo");
app.UseStaticFiles(new StaticFileOptions { FileProvider = fileProvider, RequestPath = requestPath, ServeUnknownFileTypes = true, });
app.UseDirectoryBrowser(new DirectoryBrowserOptions { FileProvider = fileProvider, RequestPath = requestPath });
.UseWebRoot(@"D:\MyGitRepo")
.UseContentRoot(@"D:\MyGitRepo")
the directory browser does not show the .git
folder and the .gitignore
file is not found, how to resolve this issue?
CodePudding user response:
You can configure it by using PhysicalFileProvider
constructor's second parameter:
using Microsoft.Extensions.FileProviders.Physical;
...
...
var fileProvider = new PhysicalFileProvider(@"D:\MyGitRepo", ExclusionFilters.None);