Skip to content

Commit

Permalink
Set JGit name / email #6
Browse files Browse the repository at this point in the history
  • Loading branch information
josiasmontag committed Jan 24, 2017
1 parent c8f6039 commit b05400b
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public class GitService {
@Value("${exerciseapp.repo-clone-path}")
private String REPO_CLONE_PATH;

@Value("${exerciseapp.git.name}")
private String GIT_NAME;

@Value("${exerciseapp.git.email}")
private String GIT_EMAIL;


private HashMap<Path, Repository> cachedRepositories = new HashMap<>();

Expand Down Expand Up @@ -117,7 +123,7 @@ public Repository getOrCheckoutRepository(URL repoUrl) throws IOException, GitAP
*/
public void commitAndPush(Repository repo, String message) throws GitAPIException {
Git git = new Git(repo);
git.commit().setMessage(message).setAllowEmpty(true).call();
git.commit().setMessage(message).setAllowEmpty(true).setCommitter(GIT_NAME, GIT_EMAIL).call();
git.push().setCredentialsProvider(new UsernamePasswordCredentialsProvider(GIT_USER, GIT_PASSWORD)).call();
}

Expand Down

0 comments on commit b05400b

Please sign in to comment.