Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
i have tried to connect GIT-Extension using C# (windows Form application) to fetch all the branch details and specific file from Repository,

What I have tried:

i have tried below code to connect and fetch the files but throws exceptions.

Process gitProcess = new Process();

                gitProcess.StartInfo.FileName = // path for common batch file
                gitProcess.StartInfo.Arguments = "--login -i";
                gitProcess.StartInfo.CreateNoWindow = true;
                gitProcess.StartInfo.UseShellExecute = false;
                gitProcess.StartInfo.RedirectStandardOutput = true;
                gitProcess.StartInfo.RedirectStandardError = true;
                gitProcess.StartInfo.RedirectStandardInput = true;
                gitProcess.StartInfo.WorkingDirectory = selectedRepoOption;

                var output = new StringBuilder();
                string[] finaloutput;
                using (var outputWaitHandle = new AutoResetEvent(false))
                {
                    gitProcess.OutputDataReceived += (outputsender, e1) =>
                    {
                        // attach event handler
                        if (e1.Data == null)
                        {
                            outputWaitHandle.Set();
                        }
                        else if (e1.Data.EndsWith("xml"))
                        {
                            output.AppendLine(e1.Data + "#");
                        }
                    };


help me to connect and retrieve specific files and branch names
Posted
Updated 12-Jun-19 3:32am
Comments
F-ES Sitecore 12-Jun-19 9:22am    
Those exceptions tell you what the problem is, when you get an exception always post the details of the exception so people can help. It's like phoning a mechanic and saying "a warning light is on my dashboard, what is the problem?" The mechanic needs to know the details of the light to say what the problem is.

1 solution

Try running the example with ProcessStartInfo mentioned in answer 2 here: c# - Is there some way to work with git using .NET application? - Stack Overflow[^]
And see if that works ...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900