Exemple #1
0
        static void Main(string[] args)
        {
            GitRepositoryManager git = new GitRepositoryManager("UserName", "Name", "Repo", @"localRepo");

            git.CommitAllChanges("Name");
            git.PushCommits("origin", "master");
        }
Exemple #2
0
        // 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));
        }