C# - Find git repository programmatically - source code requested

In a C# windows form application, if I want to scan my entire hard drive and locate all of the git repositories that were created using "git clone [path_to_repository]".  Of course I know where they all are already - I want to find the same repos programmatically. -- how would this best be done?

When a "git clone ..." command is run, are there always certain files created?  Tell-tale ways to know a folder is a repo?

Is the presence of a hidden ".git" folder enough to pretty much a "guarantee" that I am inside a repository?

Please provide working C# source code.
Tom KnowltonWeb developerAsked:
Who is Participating?
plusone3055Connect With a Mentor Commented:
I suggest looking at github


The API/SDK may have the source code you need :)
Tom KnowltonWeb developerAuthor Commented:
An interesting share, but I still want to accomplish the above FIRST - then perhaps use the library to run git commands SECOND.
Tom KnowltonWeb developerAuthor Commented:
Well, no other takers, so you get the points, my friend.

My final solution was to not try and find the .git folders.  It took such a long time to search the entire drive that it was not worth attempting a brute force approach.  So I just have the user provide the git directory herself.

I will still consider your advice and will pursue it more if I think I need to.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.