forge init


forge-init - Create a new Forge project.


forge init [options] [root]


Create a new Forge project in the directory root (by default the current working directory).

The default template creates the following project layout:

├── foundry.toml
├── lib
│   └── forge-std
│       ├── LICENSE-APACHE
│       ├── LICENSE-MIT
│       ├──
│       ├── foundry.toml
│       ├── package.json
│       ├── scripts
│       ├── src
│       └── test
├── script
│   └── Counter.s.sol
├── src
│   └── Counter.sol
└── test
    └── Counter.t.sol

8 directories, 10 files

However, it is possible to create a project from another using --template.

By default, forge init will also initialize a new git repository, install some submodules and create an initial commit message.

If you do not want this behavior, pass --no-git.


Init Options

    Create the project even if the specified root directory is not empty.

-t template
--template template
    The template to start from.

    Create a .vscode/settings.json file with Solidity settings, and generate a remappings.txt file.

    Do not install dependencies from the network.

VCS Options

    Do not create an initial commit.

    Do not create a git repository.

Display Options

    Do not print any messages.

Common Options

    Prints help information.


  1. Create a new project:

    forge init hello_foundry
  2. Create a new project, but do not create a git repository:

    forge init --no-git hello_foundry
  3. Forcibly create a new project in a non-empty directory:

    forge init --force