Package com.mooltiverse.oss.nyx.git
Class Git
java.lang.Object
com.mooltiverse.oss.nyx.git.Git
The entry point to the Git local and remote service. This is also the main entry point to retrieve
Repository instances-
Method Summary
Modifier and TypeMethodDescriptionReturns a repository instance working in the given directory after cloning from the given URI.Returns a repository instance working in the given directory after cloning from the given URI.Returns a repository instance working in the given directory after cloning from the given URI.Returns a repository instance working in the given directory after cloning from the given URI.Returns a repository instance working in the given directory after cloning from the given URI.Returns a repository instance working in the given directory after cloning from the given URI.static Gitinstance()Returns an instance using default options.Returns a repository instance working in the given directory.Returns a repository instance working in the given directory.
-
Method Details
-
instance
Returns an instance using default options.- Returns:
- an instance using default options.
-
clone
Returns a repository instance working in the given directory after cloning from the given URI. This method uses no authentication.- Parameters:
directory- the directory where the repository has to be cloned. It is created if it doesn't exist.uri- the URI of the remote repository to clone.- Returns:
- the new repository object.
- Throws:
NullPointerException- if any of the given objects isnullIllegalArgumentException- if a given object is illegal for some reason, like referring to an illegal repositoryGitException- in case the operation fails for some reason, including when authentication fails
-
clone
public Repository clone(File directory, String uri, String user, String password) throws GitException Returns a repository instance working in the given directory after cloning from the given URI.- Parameters:
directory- the directory where the repository has to be cloned. It is created if it doesn't exist.uri- the URI of the remote repository to clone.user- the user name to use when credentials are required. If this andpasswordare bothnullthen no credentials is used. When using single token authentication (i.e. OAuth or Personal Access Tokens) this value may be the token or something other than a token, depending on the remote provider.password- the password to use when credentials are required. If this anduserare bothnullthen no credentials is used. When using single token authentication (i.e. OAuth or Personal Access Tokens) this value may be the token or something other than a token, depending on the remote provider.- Returns:
- the new repository object.
- Throws:
NullPointerException- if any of the given objects isnullIllegalArgumentException- if a given object is illegal for some reason, like referring to an illegal repositoryGitException- in case the operation fails for some reason, including when authentication fails
-
clone
public Repository clone(File directory, String uri, String privateKey, byte[] passphrase) throws GitException Returns a repository instance working in the given directory after cloning from the given URI.- Parameters:
directory- the directory where the repository has to be cloned. It is created if it doesn't exist.uri- the URI of the remote repository to clone.privateKey- the SSH private key. Ifnullthe private key will be searched in its default location (i.e. in the users'$HOME/.sshdirectory).passphrase- the optional password to use to open the private key, in case it's protected by a passphrase. This is required when the private key is password protected as this implementation does not support prompting the user interactively for entering the password.- Returns:
- the new repository object.
- Throws:
NullPointerException- if any of the given objects isnullIllegalArgumentException- if a given object is illegal for some reason, like referring to an illegal repositoryGitException- in case the operation fails for some reason, including when authentication fails
-
clone
Returns a repository instance working in the given directory after cloning from the given URI. This method uses no authentication.- Parameters:
directory- the directory where the repository has to be cloned. It is created if it doesn't exist.uri- the URI of the remote repository to clone.- Returns:
- the new repository object.
- Throws:
NullPointerException- if any of the given objects isnullIllegalArgumentException- if a given object is illegal for some reason, like referring to an illegal repositoryGitException- in case the operation fails for some reason, including when authentication fails
-
clone
public Repository clone(String directory, String uri, String user, String password) throws GitException Returns a repository instance working in the given directory after cloning from the given URI.- Parameters:
directory- the directory where the repository has to be cloned. It is created if it doesn't exist.uri- the URI of the remote repository to clone.user- the user name to use when credentials are required. If this andpasswordare bothnullthen no credentials is used. When using single token authentication (i.e. OAuth or Personal Access Tokens) this value may be the token or something other than a token, depending on the remote provider.password- the password to use when credentials are required. If this anduserare bothnullthen no credentials is used. When using single token authentication (i.e. OAuth or Personal Access Tokens) this value may be the token or something other than a token, depending on the remote provider.- Returns:
- the new repository object.
- Throws:
NullPointerException- if any of the given objects isnullIllegalArgumentException- if a given object is illegal for some reason, like referring to an illegal repositoryGitException- in case the operation fails for some reason, including when authentication fails
-
clone
public Repository clone(String directory, String uri, String privateKey, byte[] passphrase) throws GitException Returns a repository instance working in the given directory after cloning from the given URI.- Parameters:
directory- the directory where the repository has to be cloned. It is created if it doesn't exist.uri- the URI of the remote repository to clone.privateKey- the SSH private key. Ifnullthe private key will be searched in its default location (i.e. in the users'$HOME/.sshdirectory).passphrase- the optional password to use to open the private key, in case it's protected by a passphrase. This is required when the private key is password protected as this implementation does not support prompting the user interactively for entering the password.- Returns:
- the new repository object.
- Throws:
NullPointerException- if any of the given objects isnullIllegalArgumentException- if a given object is illegal for some reason, like referring to an illegal repositoryGitException- in case the operation fails for some reason, including when authentication fails
-
open
Returns a repository instance working in the given directory.- Parameters:
directory- the directory where the repository is.- Returns:
- the new repository object.
- Throws:
NullPointerException- if the given object isnullIllegalArgumentException- if the given object is illegal for some reason, like referring to an illegal repositoryIOException- in case of any I/O issue accessing the repository
-
open
Returns a repository instance working in the given directory.- Parameters:
directory- the directory where the repository is.- Returns:
- the new repository object.
- Throws:
NullPointerException- if the given object isnullIllegalArgumentException- if the given object is illegal for some reason, like referring to an illegal repositoryIOException- in case of any I/O issue accessing the repository
-