public async Task BranchUsingLocalGit(long buildId, string branchName) { VcsCommit commit = await GetCommitInformationByBuildId(buildId); if (commit == null) { Log.Info("Could not find commit for build. Skipping creation of branch step."); return; } IGitRepository gitRepository = _gitRepositoryFactory.Clone(commit); if (gitRepository == null) { throw new Exception("Unable to Clone Git Repository and create branch"); } if (gitRepository.AddBranch(branchName, commit.CommitSha)) { gitRepository.CheckoutBranch(branchName); gitRepository.Push(branchName); } gitRepository.DeleteFolder(); }
public void Push() { Log.Info($"==== Push changes to TeamCity's settings git repository ===="); _gitRepository.Push("master"); _gitRepository.DeleteFolder(); }