-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
This guide covers how to install Fisherman on your system and get started with Git hook management.
- Rust 1.70 or higher (for building from source)
- Git 2.0 or higher
- Operating System: Linux, macOS, or Windows (with WSL)
Install Fisherman using Cargo, Rust's package manager:
cargo install --git https://github.com/evg4b/fisherman.gitThis will:
- Clone the repository
- Build the binary
- Install it to
~/.cargo/bin/fisherman
Make sure ~/.cargo/bin is in your PATH.
After installation, verify that Fisherman is available:
fisherman --versionYou should see output like:
fisherman 0.0.1
Once installed, follow these steps to start using Fisherman:
Create a .fisherman.toml file in your Git repository:
cd /path/to/your/repo
touch .fisherman.tomlEdit .fisherman.toml with your preferred text editor:
# Example: Run tests before committing
[[hooks.pre-commit]]
type = "exec"
command = "cargo"
args = ["test"]
# Example: Validate commit message format
[[hooks.commit-msg]]
type = "message-regex"
regex = "^(feat|fix|docs|style|refactor|test|chore):\\s.+"Install the configured hooks into your repository:
fisherman installThis creates executable hook scripts in .git/hooks/ that call Fisherman with the appropriate hook name.
Try making a commit to test your hooks:
git add .
git commit -m "feat: test fisherman hooks"If configured correctly, your hooks will execute and validate the commit.
Fisherman supports three configuration scopes. See Configuration for details.
Create a global configuration that applies to all repositories:
touch ~/.fisherman.tomlEdit the file with rules you want to apply everywhere:
# ~/.fisherman.toml
# Enforce conventional commits globally
[[hooks.commit-msg]]
type = "message-regex"
regex = "^(feat|fix|docs|style|refactor|test|chore)(\\(.+\\))?:\\s.+"Create a repository-specific configuration:
cd /path/to/your/repo
touch .fisherman.tomlThis configuration is shared with all developers via Git.
Create a local configuration (not shared via Git):
cd /path/to/your/repo
touch .git/.fisherman.tomlThis is useful for personal preferences you don't want to commit to the repository.
fisherman installThis installs all hooks that have rules defined in your configuration files.
fisherman install pre-commit commit-msgThis installs only the specified hooks.
fisherman install --forceThis overwrites existing hook scripts. The original scripts are backed up with a .bkp extension.
To remove Fisherman hooks, simply delete the hook scripts from .git/hooks/:
cd /path/to/your/repo
rm .git/hooks/pre-commit
rm .git/hooks/commit-msg
# ... etcIf you forced installation and want to restore original hooks:
cd .git/hooks
mv pre-commit.bkp pre-commit
mv commit-msg.bkp commit-msg
# ... etcTo update Fisherman to the latest version:
cargo install --git https://github.com/evg4b/fisherman.git --forceAfter updating, reinstall hooks in your repositories:
cd /path/to/your/repo
fisherman install --forceThis ensures the hook scripts point to the latest Fisherman binary.
No special considerations. Fisherman should work out of the box.
No special considerations. Fisherman should work out of the box.
Fisherman should work in WSL (Windows Subsystem for Linux). Make sure you're using a Unix-style Git installation within WSL.
Note: Fisherman may not work correctly with native Windows Git due to differences in how hooks are executed.
Problem: Cargo's binary directory is not in your PATH.
Solution: Add ~/.cargo/bin to your PATH:
# For bash
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# For zsh
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcProblem: Hook scripts don't have execute permissions.
Solution: Fisherman automatically sets execute permissions, but if you encounter this issue:
chmod +x .git/hooks/pre-commit
chmod +x .git/hooks/commit-msg
# ... etcProblem: Hooks are installed but don't execute.
Possible causes:
-
Hooks disabled in Git configuration:
git config --get core.hooksPath
If this returns a value, Git is using a custom hooks directory. Either:
- Install Fisherman hooks in that directory, or
- Unset the custom hooks path:
git config --unset core.hooksPath
-
Hook script not executable:
ls -la .git/hooks/pre-commit
Should show
-rwxr-xr-xpermissions. -
Configuration errors:
fisherman explain pre-commit
This shows what rules are configured and helps identify configuration issues.
Problem: cargo install fails with compilation errors.
Solutions:
-
Update Rust:
rustup update
-
Check Rust version:
rustc --version
Make sure you have Rust 1.70 or higher.
-
Clean cargo cache and retry:
cargo clean cargo install --git https://github.com/evg4b/fisherman.git --force
Now that Fisherman is installed:
-
Learn about configuration - Read Configuration to understand how to structure your
.fisherman.tomlfiles - Explore available rules - Check Rules Reference for all available rule types
- Use variables and templates - Learn about Variables and Templates for dynamic configurations
- See examples - Browse Examples for real-world use cases
- Understand Git hooks - Read Git Hooks for information about available hooks
- Documentation - Check this wiki for comprehensive guides
- Issues - Report bugs or request features at GitHub Issues
-
CLI Help - Run
fisherman --helpfor command-line usage information