JGit: getting exception while commit (TransportException: Nothing to push) via Jenkins

Multi tool use
Multi tool use


JGit: getting exception while commit (TransportException: Nothing to push) via Jenkins



Below code is working fine when running on local, however throwing exception while running the same via jenkins.


Git git = Git.open(gitWorkDir);
Repository repo = git.getRepository();
log.info(repo.getDirectory().getPath());

String userName = envProperties.getString("username");
String password = envProperties.getString("password");
UsernamePasswordCredentialsProvider user = new UsernamePasswordCredentialsProvider(userName, password);
PullResult result = git.pull().setCredentialsProvider(user).setRemote("origin")
.setRemoteBranchName("master").call();
if (result.isSuccessful()) {
git.add().addFilepattern(Constant.LABEL_API_PROJECT_NAME + Constant.SKINS_PATH).call();

ObjectId lastCommitId = repo.resolve(Constants.HEAD);
revWalk = new RevWalk(repo);
RevCommit commit = revWalk.parseCommit(lastCommitId);
log.info(commit.getAuthorIdent());
git.commit().setMessage("Message").call();
git.push().setCredentialsProvider(user).call();









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

YLpeKRT
KmF,ex2 EiNY7gf,5TCcY1,AzIE,GWwl1Uzl w0KmbUS8fP6ua9ty

Popular posts from this blog

PHP contact form sending but not receiving emails

Do graphics cards have individual ID by which single devices can be distinguished?

Create weekly swift ios local notifications