CLI Usage

Learn how to use the Forge CLI commands for site management, deployment, and configuration.

Forge CLI Interface

Helpers

Get help and version information:

forge-cli -v
forge-cli --help

forge-cli <task> --help

Authentication

Manage your authentication with Forge:

Interactive Login

forge-cli login

Will prompt for user email and password to authenticate

Direct Login

forge-cli login --email "me@example.com" --password "qwerty123"

Login by passing your credentials

Logout

forge-cli logout

Will logout and clear your session / stored credentials

Methods

Core CLI commands for site management:

Create Site

forge-cli create

Create a new forge site (subject to account limitations)

forge-cli create --name "hammer"

Will create a site called "hammer"

forge-cli create --name "hammerformac.com" --custom

Create a custom domain (if allowed) with name hammerformac.com

Add Site

forge-cli add hammerformac.com

Will assign the remote site to the current directory

Deploy Site

forge-cli deploy

Deploy site to the linked remote destination (if present)

forge-cli deploy hammerformac.com

Deploy the explicitly referenced site

forge-cli deploy -m "added new page"

Deploy with version description message

Rollback

forge-cli rollback

Rollback related site to last version

forge-cli rollback --version "123"

Rollback site to specified version (coming soon)

List Versions

forge-cli versions

List all versions for the site (coming soon)

List Sites

forge-cli sites

Lists the sites available for current user

Initialize Project

forge-cli init

Create a hammer.json file in the project with forge configuration settings as needed

Authentication

Set up authentication for your Forge account:

  1. Run forge-cli login to start the authentication process
  2. Follow the browser prompts to log in to your Forge account
  3. Grant necessary permissions when prompted
  4. Verify authentication with forge-cli whoami

Configuration

Configure your CLI settings:

  • Default Site: Set a default site for deployments
  • Editor: Configure your preferred text editor
  • Output Format: Set JSON or table output format
  • Debug Mode: Enable debug logging when needed

Next Steps

After successful installation:

  1. Create your first site with forge-cli create
  2. Deploy a test project
  3. Explore advanced features and commands
  4. Set up automation for your workflow

Join the Discussion

Have questions or want to share your experience? Join our community discussion to connect with other developers and get help from the Forge team.

Visit Forum Discussion