Interactive Shell
Gitit provides a convenient feature to open an interactive shell in your newly created project directory after cloning a template. This can help you quickly start working with your new project without having to manually navigate to the directory.
Basic Usage
To use the interactive shell feature, add the --shell
flag when cloning a template:
gitit github:user/repo my-project --shell
This will:
- Clone the template repository
- Extract it to the
my-project
directory - Open a new shell session in that directory
How It Works
Under the hood, Gitit uses your default shell environment to open a new shell session. The process is:
- The template is downloaded and extracted
- Gitit determines your current shell (from
process.env.SHELL
or defaults to/bin/bash
on Unix andcmd.exe
on Windows) - It spawns a new shell process in the target directory
- Control is transferred to the new shell session
- When you exit the shell, you return to the original session
Shell Environment
The shell opened by Gitit is a fully functional environment with:
- The working directory already set to your new project directory
- Access to all your normal shell configurations (from
.bashrc
,.zshrc
, etc.) - All environment variables from your current session
Combining with Other Options
The --shell
option works well when combined with other Gitit features:
# Clone a template, install dependencies, and open a shell
gitit github:user/repo my-project --install --shell
# Clone a template, run a custom command, and open a shell
gitit github:user/repo my-project --command "npm run setup" --shell
In these cases, the shell opens after any other post-clone operations are completed.
Configuration
You can set the interactive shell feature as a default in your gitit.config.ts
file:
// gitit.config.ts
export default {
shell: true,
// other options...
}
With this configuration, Gitit will always open a shell after cloning a template, unless explicitly disabled with --no-shell
.
Use Cases
The interactive shell feature is particularly useful for:
- Immediate development - Start working on your project right away
- Running initial setup - Quickly run setup commands in the new project
- Exploration - Easily browse through the template's file structure
- Verification - Confirm that everything was properly cloned
Platform-Specific Behavior
The shell behavior varies slightly depending on your operating system:
- macOS/Linux: Opens your default shell as specified in the
SHELL
environment variable - Windows: Opens Command Prompt (
cmd.exe
)
Example Workflow
A typical workflow using the interactive shell might look like:
# Clone a template and open a shell
gitit github:vuejs/vue-next-webpack-preview my-vue-app --shell
# In the new shell, you can immediately start working
npm install
npm run dev
This streamlines the process of creating a new project from a template and getting it up and running.