-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jgit push throwing org.eclipse.jgit.api.errors.TransportException: Connection reset #126
Comments
to add some more notes, we are accessing github repo behind the firewall, so i added below to set http and https proxy of the host and port before push and tried but still getting same error. System.setProperty("http.proxyHost","host name"); |
Impossible to say what's wrong with the little information you gave us. There are typos in the code and presumably in the exception trace ("gihub"), and the exception trace is not complete, and we don't know if there were any earlier exceptions that might be relevant. We can only guess, but such guesses may be completely off since we don't have enough information. I'll venture one guess anyway: try using not the JDK HTTP client but the Apache HTTP client. The JDK does not allow connecting to an HTTPS server with Basic Authentication through a HTTP proxy. |
sorry for typo, that is https://github.com/{our internal url}. I have attached snapshot. can you share some Apache HTTP client examples with jgit library. |
Look at the JGit tests. Basically you'll need to include bundle |
I have added as you suggested before push HttpTransport.setConnectionFactory(new HttpClientConnectionFactory()); I am getting error 407 407 Proxy Authentication Required, however i had already set proxy details like i shown above before jgit calls. |
As i mentioned jgit pull and fetch are working with these setting proxy details only push is failing. System.setProperty("http.proxyHost","host name"); |
If you have a proxy that requires authentication you'll also need to set up an I don't know why only the push fails. Possibly the Github repository is set up to allow anonymous fetches, but requires authentication only for pushes. You could also try to use Eclipse and see if EGit can do the push if you define the correct proxy settings, including proxy password, if any, in the Eclipse preferences. (Easiest way: install Eclipse, open the Git Repositories view, import an existing clone, make sure testbranch1 is checked out. Go to the preferences, make sure the proxy settings are correct, and choose "Apache HTTP" as HTTP client in the Version Control(Team)→Git preferences. Then choose "Push to origin" in the context menu of the repository in the Git Repositories view.) I'm sorry we cannot help you much. If neither of the above suggestions help, you'll have to debug this yourself. |
Yes, i am using PAT, "test"=PAT, git push origin testbranch1 works fine. I only have issue with jgit push. i tried all possible options. |
Version
7.0.0.202409031743-r
Operating System
Windows
Bug description
I am trying to push the branch to the remote repo as soon as after i create and checkout the branch. Here is the code i used. Please note fetch and pull works fine.
Ref ref = git.checkout.setCreateBranch(true).setName("testbranch1").setUpstreamMode(CreateBranchCommandMode.SET_UPSTREAM).
setStartPoint("origin/main").call();
System.out.println("Git Reference branch name:"+ref.getName();
Thread.sleep(10000);
git.push().setRemote("origin").add("testbranch1").setCrendentialsProvider(new UserNamePasswordCrendentialsProvider("test","test").call();
Actual behavior
jgit push is throwing connection reset error
Expected behavior
jgit should work fine.
Relevant log output
Other information
No response
The text was updated successfully, but these errors were encountered: