[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] [Support] JGit requires authentication but git on the command-line doesn't

On Thu, May 30, 2019 at 12:27 PM Raafat Waheb <raafatwahb@xxxxxxxxx> wrote:
Hi,Â

Could you please help with the following:Â

I'm using JGit to commit and push changes in a git repository. It seems like the command git push on the command line is different from git.push().call() in JGit

Native git is a command line application and JGit is a Java library which can be used to build applications.
Â
git push asks me for the first time to enter credentials. When I run it again, it doesn't
This is because my installation of git is configured like: git config --global credential.helper wincred

JGit however fails with the error: "Authentication is required but no CredentialsProvider has been registered"Â
Which CredentialsProvider should I use for this case?ÂNone of the availableÂCredentialsProvidersÂ(UsernamePasswordCredentialsProvider,ÂConsoleCredentialsProvider)Âsuit my needs

Set any of the existing ones in your application or implement a new one if none of these suits your needs.
EGit implements the EGitCredentialsProvider [1] which integrates with the Eclipse secure store.
Also see [2].

My last resort would be to fork a process "git push" if JGit is unable to use the cached credentials

JGit currently does not have an integration with git credentials helpers [3]. Maybe you want to contribute that [4] ?


-MatthiasÂ