static void Main(string[] args) { GitRepositoryManager git = new GitRepositoryManager("UserName", "Name", "Repo", @"localRepo"); git.CommitAllChanges("Name"); git.PushCommits("origin", "master"); }
// POST: api/Commit public IHttpActionResult Post([FromBody] Body value) { string username = ConfigurationManager.AppSettings["Username"]; string password = ConfigurationManager.AppSettings["Password"]; string remote = ConfigurationManager.AppSettings["RemoteName"]; string branch = ConfigurationManager.AppSettings["RefName"]; value.LocalFolder = value.LocalFolder.Replace("\\", @"\"); GitRepositoryManager manager = new GitRepositoryManager(username, password, value.RepoUrl, value.LocalFolder); bool result = manager.CommitAllChanges(value.Comment); if (result) { manager.PushCommits(remote, branch); return(Ok()); } return(StatusCode(HttpStatusCode.NoContent)); }