Solved

C# - Find git repository programmatically - source code requested

Posted on 2016-08-10
3
133 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Error in JQuery 5 38
Eclipse with gitlab 1 12
Where can I ask about my ASP.NET MVC project? 6 19
C# guarantee sql connection close 6 13
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
In this article you will learn how to create a free basic website on Bitbucket, a git service provider. Polymer creates dynamic HTML components, which allow more flexibility than static HTML. This tutorial uses Ubuntu Linux but can also be done on W…
How to create a branch, fetch changes, and merge them into another branch 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.

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now