首页 > 代码库 > git for c#, commit本地,pushserver
git for c#, commit本地,pushserver
//ok private static void push() { string wkDir = @"E:\DotNet2010\单位project\Git.Client\lib2Test\ConsoleApplication1\bin\Debug\D2Git\.git"; using (var repo = new Repository(wkDir)) { //此时必须保证存在 one.txt,two.txt 两个文件 string fname = "one.txt"; repo.Index.Stage(fname); repo.Commit("add one", Constants.Signature, Constants.Signature); fname = "two.txt"; repo.Index.Stage(fname); repo.Commit("add two", Constants.Signature, Constants.Signature); var nk = repo.Network; PushOptions po = new PushOptions { CredentialsProvider = (x, y, z) => new UsernamePasswordCredentials { Username = "admin", Password = "admin" } }; nk.Push(repo.Head, po); nk.Push(repo.Branches["master"], po); } }
public static class Constants { public static readonly Signature Signature = new Signature("javasuki", "javasuki@hotmail.com", new DateTimeOffset(2014, 06, 22, 10, 58, 27, TimeSpan.FromHours(2))); }
git for c#, commit本地,pushserver
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。