3

I'm implementing a happy path git push with JGit.

Situation:

  • I have a git repository (local) that links to a remote git repository (origin)
  • git on my machine has been configured with git config --global credential.helper wincred
  • The first time I do an operation that requires authentication (such as git push), it asks for username/password and I input them manually.
  • The second time, it doesn't


In this happy path, I assume that git credentials are already configured and these credentials are cached.

With JGit, this code fails: git.push().call();
Isn't that statement equivalent to git push from the command line?

If git push from the command line succeeds, then why does JGit fail with "Authentication is required but no CredentialsProvider has been registered"?

If what I am looking for is not possible, I might just fork a process! What do you advise?

Note: the remote could support both ssh or https. In the case I describe above, it supports only http and the remote url = http://<user>@<git-server>/.../<git-repo>.git

user640853
  • 163
  • 10
  • 1
    [This bug](https://bugs.eclipse.org/bugs/show_bug.cgi?id=441198) looks like it answers your question - jgit doesn't have support for `credential.helper` – Anya Shenanigans May 30 '19 at 10:23

0 Answers0