Solved

C# - Find git repository programmatically - source code requested

Posted on 2016-08-10
3
225 Views
Last Modified: 2016-08-18
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.
0
Comment
Question by:knowlton
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
plusone3055 earned 500 total points
ID: 41751045
I suggest looking at github

https://github.com/manojlds/cmd

The API/SDK may have the source code you need :)
0
 
LVL 5

Author Comment

by:knowlton
ID: 41751127
An interesting share, but I still want to accomplish the above FIRST - then perhaps use the library to run git commands SECOND.
0
 
LVL 5

Author Closing Comment

by:knowlton
ID: 41761160
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.

Tom
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to create a Git repository using GitHub, and how to clone and checkout the repository using the EGit plugin for Eclipse.
Explains the Git Index and the differences between a Remote, a Remote Tracking Branch, and a Local (or Tracking) branch.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question