Azure Function Cloning Git Folder to Local Directory

Viewed 116

I have an Azure function running on Windows App Service S1 where I'm calling an uploaded copy of git.exe to clone a repo into the hosted, shared directory like so (calling git and passing arguments works surprisingly)

   using (System.Diagnostics.Process p = new Process())
         {
            p.StartInfo = new ProcessStartInfo()
             {
                RedirectStandardInput = true,
                RedirectStandardOutput = true,
                UseShellExecute = false,
                FileName = @"D:\home\site\wwwroot\git.exe",if
                     Arguments = $"-C {clonePath} clone https://github.com/{orgName}/{repo}.git " + $"--depth 100"
                };

                p.Start();
                string output = p.StandardOutput.ReadToEnd();
                _logger.LogInformation($"Git clone output: {output}");
                p.WaitForExit();
          }

The command executes but the issue is for some reason it doesn't copy the .git folder. Subsequent code doesn't recognize the folder as a valid git repo. It seems to copy everything else. I think the issue has something to do with the fact that the git folder is hidden by nature. clonePath is in the same "D:\home\site\wwwroot" directory, under a new folder like "GitFolder". This directory is supposed to be an accessible mapped storage share on App Service. When I look at the folder in Kudu, it doesn't list the git folder either. Is there something special I'm supposed to do?

0 Answers
Related