Package org.eclipse.jgit.api
Class RemoteAddCommand
- java.lang.Object
-
- org.eclipse.jgit.api.GitCommand<RemoteConfig>
-
- org.eclipse.jgit.api.RemoteAddCommand
-
- All Implemented Interfaces:
Callable<RemoteConfig>
public class RemoteAddCommand extends GitCommand<RemoteConfig>
Used to add a new remote. This class has setters for all supported options and arguments of this command and acall()
method to finally execute the command.- Since:
- 4.2
- See Also:
- Git documentation about Remote
-
-
Field Summary
-
Fields inherited from class org.eclipse.jgit.api.GitCommand
repo
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RemoteAddCommand(Repository repo)
Constructor for RemoteAddCommand.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RemoteConfig
call()
RemoteAddCommand
setName(String name)
The name of the remote to add.RemoteAddCommand
setUri(URIish uri)
The URL of the repository for the new remote.-
Methods inherited from class org.eclipse.jgit.api.GitCommand
checkCallable, getRepository, setCallable
-
-
-
-
Constructor Detail
-
RemoteAddCommand
protected RemoteAddCommand(Repository repo)
Constructor for RemoteAddCommand.- Parameters:
repo
- theRepository
-
-
Method Detail
-
setName
public RemoteAddCommand setName(String name)
The name of the remote to add.- Parameters:
name
- a remote name- Returns:
- this instance
- Since:
- 5.0
-
setUri
public RemoteAddCommand setUri(URIish uri)
The URL of the repository for the new remote.- Parameters:
uri
- an URL for the remote- Returns:
- this instance
- Since:
- 5.0
-
call
public RemoteConfig call() throws GitAPIException
Execute the command
Executes the
remote add
command with all the options and parameters collected by the setter methods of this class.- Specified by:
call
in interfaceCallable<RemoteConfig>
- Specified by:
call
in classGitCommand<RemoteConfig>
- Throws:
GitAPIException
-
-