Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jgit-dev] How to Check if A Git Clone Has Been Done Already with JGit


While using jgit to access git repositories from java code, I came across this issue. Since cloning to a non-empty directory is not allowed, I need to check if the local repository has been cloned before. If it has been cloned earlier, I perform only a git pull, else I do a clone. Currently I'm checking the root directory of the local repository to find out if a clone has been made or not. My approach is as follows:

if a root folder is existing in the specified location in local file system
     clone has been done
 I'm not sure whether this is correct. Any better way to do this with jgit?

Thanks and Regards,

Back to the top