I try to create a local branch and push it to remote. When I use the following code local branch created and when the execution comes to pushCommand.call()
in pushHotfixBranchToRemote()
method, it is throwing an exception
org.eclipse.jgit.api.errors.TransportException: ssh://approot@192.168.57.65:22/u01/gitroot/apdt_v16_test/dev/appbi.git: Auth fail
the above scenario happened while running the class on a Linux machine where the cloned source is present in same machine and the bare is present in another one.
But when i tried the same in my local machine(windows) where the clone and bare in same machine but different drive , it is working fine.
Some answer for these kinda questions says , that we hav to check .ssh folder. But i dont knw anything about it. kindly help me to solv
private void createLocalHotFixBranch() {
CreateBranchCommand createBranchCommand = null;
try {
portalLogger.debug("Inside createLocalHotFixBranch()");
createBranchCommand = gitObject.branchCreate();
createBranchCommand.setName(GitBranchConstants.hotFixBranchName + "_" + releaseVersion)
.setStartPoint("origin/" + GitBranchConstants.releaseBranchName).call();
} catch (GitAPIException e) {
portalLogger.error("Error occured in createLocalHotFixBranch --> " + e.getMessage());
e.printStackTrace();
}
}
private void pushHotfixBranchToRemote() {
PushCommand pushCommand = null;
try {
portalLogger.debug("Inside pushHotfixBranchToRemote()");
pushCommand = gitObject.push();
pushCommand.setRemote("origin");
pushCommand.setRefSpecs(new RefSpec(GitBranchConstants.hotFixBranchName + "_" + releaseVersion + ":"
+ GitBranchConstants.hotFixBranchName + "_" + releaseVersion));
pushCommand.call();
} catch (GitAPIException e) {
portalLogger.error("Error occured in pushHotfixBranchToRemote --> " + e.getMessage());
e.printStackTrace();
}
}
exception is
org.eclipse.jgit.api.errors.TransportException: ssh://approot@192.168.57.65:22/u01/gitroot/apdt_v16_HotfixTest/dev/core.git: Auth fail
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:160)
at com.echain.project.HotFixBranchCreationTest.pushHotfixBranchToRemote(HotFixBranchCreationTest.java:121)
at com.echain.project.HotFixBranchCreationTest.initiateHotfixCreationProcess(HotFixBranchCreationTest.java:65)
at com.echain.project.HotFixBranchCreationTest.main(HotFixBranchCreationTest.java:169)
Caused by: org.eclipse.jgit.errors.TransportException: ssh://approot@192.168.57.65:22/u01/gitroot/apdt_v16_HotfixTest/dev/core.git: Auth fail
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:159)
at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136)
at org.eclipse.jgit.transport.TransportGitSsh$SshPushConnection.<init>(TransportGitSsh.java:320)
at org.eclipse.jgit.transport.TransportGitSsh.openPush(TransportGitSsh.java:166)
at org.eclipse.jgit.transport.PushProcess.execute(PushProcess.java:154)
at org.eclipse.jgit.transport.Transport.push(Transport.java:1200)
at org.eclipse.jgit.api.PushCommand.call(PushCommand.java:156)
... 3 more
Caused by: com.jcraft.jsch.JSchException: Auth fail
at com.jcraft.jsch.Session.connect(Session.java:512)
at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:116)
... 9 more