Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Better credentials verification
Better credentials verification [message #782621] Tue, 24 January 2012 04:15
Luis Lara is currently offline Luis LaraFriend
Messages: 5
Registered: January 2012
Junior Member
HI JGit team!

I was looking for a way to verify credentials, I scrapped some code that seems to be working, but of course, I don't know the code, so I am sure, there is a better way to do this.


public static boolean verifyCredentials(String remoteName, CredentialsProvider cred)
throws Exception {
FileRepositoryBuilder builder = new FileRepositoryBuilder();
File temp = File.createTempFile("temp", null);
Repository repository = builder.setGitDir(temp).readEnvironment().findGitDir().build();
for (WeakReference<TransportProtocol> ref : protocols) {
TransportProtocol proto = ref.get();
if (proto.canHandle(new URIish(remoteName), null, remoteName)) {
try {
Transport tx = URIish(remoteName), repository, remoteName);
return true;
} catch (Exception e) {
return false;

return false;
Previous Topic:Compare with HEAD revision and .gitignore
Next Topic:Fetch
Goto Forum:

Current Time: Mon Feb 17 21:08:11 GMT 2020

Powered by FUDForum. Page generated in 0.10248 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top