private static void SubDirFile() { string wkDir = @"E:\DotNet2010\單位工程\Git.Client\lib2Test\ConsoleApplication1\bin\Debug\D2Git\.git"; using (var repo = new Repository(wkDir)) { //必須保證工作目錄下有bb目錄,和目錄下的b.txt string fname = "dd\\b.txt"; repo.Index.Stage(fname); //commit... //push... } }轉載請注明出處:blog.csdn.net/javasuki