org.eclipse.jgit.api

## Class InitCommand

- java.lang.Object
- - org.eclipse.jgit.api.InitCommand

All Implemented Interfaces:
  Callable<Git>

    public class InitCommand
    extends Object
    implements Callable<Git>

Create an empty git repository or reinitalize an existing one

See Also:
  Git documentation about init

### Constructor Summary

Constructors
Constructor and Description
`InitCommand()`

### Method Summary

Methods
`Git` `call()` Executes the `Init` command.
`InitCommand` `setBare(boolean bare)`
`InitCommand` `setDirectory(File directory)` The optional directory associated with the init operation.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### InitCommand

    public InitCommand()

### Method Detail

#### call

    public Git call()
             throws GitAPIException

Executes the `Init` command.

Specified by:
  `call` in interface `Callable<Git>`
Returns:
  the newly created `Git` object with associated repository
Throws:
  `GitAPIException`

#### setDirectory

    public InitCommand setDirectory(File directory)

The optional directory associated with the init operation. If no directory is set, we'll use the current directory

Parameters:
  `directory` - the directory to init to
Returns:
  this instance

#### setBare

    public InitCommand setBare(boolean bare)

Parameters:
  `bare` - whether the repository is bare or not
Returns:
  this instance