This guide will help you diagnose and fix common issues with git-mit.
Here are solutions for frequently encountered error messages:
This usually means git-mit can't find or read the Git repository. Check:
- You're in a Git repository (
git statusshould work) - The
.gitdirectory has proper permissions - Your Git installation is working correctly
Your authors file has invalid TOML or YAML syntax. The error will show which format failed:
- Check for missing quotes around strings
- Ensure proper indentation (YAML is indent-sensitive)
- Validate your file with a TOML/YAML validator
- The error message will indicate whether it failed parsing as TOML or YAML
The hook installation failed because:
- ExistingHook: A non-symlink hook already exists at that location
- ExistingSymlink: A symlink exists but points to a different location
- You don't have write permissions to the hooks directory
Remove the existing hook or check where the existing symlink points.
This error appears when:
- You haven't run
git mit <initials>to set the current authors - The author configuration has expired (check
git config mit.author.expires) - The author configuration was never set in this repository
This error shows:
- The exact time when the author configuration expired
- You need to run
git mit <initials>again to refresh the configuration
If you're having issues with author configuration:
-
View all configured authors:
git mit-config mit available
This shows all authors available to git-mit. See the authors documentation for more details.
-
Check where your authors file is located:
echo $GIT_MIT_AUTHORS_CONFIG
If not set, git-mit uses the default location:
$HOME/.config/git-mit/mit.toml(or%APPDATA%\git-mit\mit.tomlon Windows) -
Verify your authors file exists:
cat $HOME/.config/git-mit/mit.toml # Or if you have a custom location: cat $GIT_MIT_AUTHORS_CONFIG
-
Check Git's stored author configuration:
git config --list | grep "^mit.author"
This shows authors stored in Git's config. Example output:
mit.author.config.bt.email=billie@example.com mit.author.config.bt.name=Billie Thompson mit.author.config.bt.signingkey=0A46826A mit.author.expires=1747556921
By default, author configuration expires after 60 minutes. If you find this timeout too short, you can extend it:
-
Using command-line flag:
git mit --timeout 480 bt se
This sets the timeout to 480 minutes (8 hours).
-
Using environment variable:
export GIT_MIT_AUTHORS_TIMEOUT=480 git mit bt seAdd this to your shell profile (
.bashrc,.zshrc, etc.) to make it permanent. -
Check current expiration time:
git config mit.author.expires
This shows the Unix timestamp when the current configuration expires.
If co-authors aren't being added to commits or commit message validation isn't working:
-
Check if hooks are installed in your repository:
ls -la .git/hooks/ | grep mitYou should see symbolic links for:
commit-msg→ mit-commit-msg (or mit-commit-msg.exe on Windows)pre-commit→ mit-pre-commit (or mit-pre-commit.exe on Windows)prepare-commit-msg→ mit-prepare-commit-msg (or mit-prepare-commit-msg.exe on Windows)
-
For global installations, check the template directory:
git config --global init.templatedir
If this returns a path, check that directory contains the hooks:
ls -la $(git config --global init.templatedir)/hooks/ -
Verify hooks are executable:
ls -la .git/hooks/ | grep mitLook for
xin the permissions (e.g.,-rwxr-xr-x)
If hooks are missing or not working:
-
For local installation (installs in current repository only):
git mit-install
-
For global installation (affects all new repositories):
git mit-install --scope=global
Then reinitialize existing repositories:
git init
See the installation documentation for more details.
-
Test the pre-commit hook:
# This should fail if no authors are set .git/hooks/pre-commitSee
mit-pre-commitfor expected behavior. -
Test commit message validation:
echo "test" > test-file.txt git add test-file.txt git commit -m "this is a commit message that is way too long and should definitely fail the 72 character limit check"
This should fail with an error about the subject being too long. See
mit-commit-msgfor details.
If lints aren't being applied as expected:
-
Check current lint status:
git mit-config lint status <lint-name>
-
Check for TOML config files:
ls -la .git-mit.toml* -
View Git config lint settings:
git config --list | grep "^mit.lint"
-
Generate current configuration:
git mit-config lint generate
This shows the effective configuration from all sources.
-
Warning about TOML override: When using
git mit-config lint enable/disable, if a TOML file exists, you'll see:Warning: your config is overridden by a repository config fileThis reminds you that the TOML file takes precedence over Git config.
Understanding where git-mit stores its data can help with troubleshooting:
-
Authors file (permanent storage):
- Default location:
$HOME/.config/git-mit/mit.toml(Linux/macOS) or%APPDATA%\git-mit\mit.toml(Windows) - Custom location: Set via
GIT_MIT_AUTHORS_CONFIGenvironment variable - Format: TOML or YAML file containing author details
- See authors documentation for file format
- Default location:
-
Git config (permanent storage):
- Stored in:
.git/config(repository level) or~/.gitconfig(global) - Keys:
mit.author.config.<initial>.<field>for author details - Set by:
git mit-config mit set [--scope=local|global] <initial> <name> <email>
- Stored in:
-
Active author state (temporary):
- Stored in:
.git/config - Keys:
user.name,user.email,user.signingkey,mit.author.coauthors.* - Expires: Controlled by
mit.author.expirestimestamp - Set by: Running
git mit <initials>
- Stored in:
-
Repository level:
- File:
.git/config - Keys:
mit.lint.<lint-name> - Set by:
git mit-config lint enable/disable <lint-name>
- File:
-
Project level (shared with team):
- Files:
.git-mit.tomlor.git-mit.toml.dist - Example: Setting
not-conventional-commit = truein[mit.lint]section - See lint configuration documentation
- Files:
- Stored in:
.git/config - Keys:
mit.relate.toandmit.relate.expires - Template:
mit.relate.template(for formatting the trailer) - Set by:
git mit-relates-to - See relates-to documentation
-
Local installation (
git mit-installorgit mit-install --scope=local):- Location:
.git/hooks/in current repository - Creates symbolic links to the actual git-mit binaries
- Location:
-
Global installation (
git mit-install --scope=global):- Sets:
init.templatedirin global Git config - Location: Template directory (e.g.,
~/.config/git/init-template/hooks/) - Applied to: New repositories when running
git initorgit clone
- Sets:
git-mit uses libgit2 for Git interactions, which follows standard Git configuration precedence:
- Repository config (
.git/config) - highest priority - User config (
~/.gitconfig) - System config (
/etc/gitconfig) - lowest priority
Lints are loaded from multiple sources with TOML files taking precedence:
-
TOML configuration files (highest priority):
.git-mit.toml(takes precedence if exists).git-mit.toml.dist(used if.git-mit.tomldoesn't exist)- Located by discovering the Git repository and checking the parent
of
.gitdirectory - For bare repositories, checks the repository directory itself
-
VCS configuration (Git config—used if no TOML config exists):
- Read from
mit.lint.<lint-name>entries - Can be set with
git mit-config lint enable/disable <lint-name> - Uses the lint's default enabled state if not explicitly configured
- Read from
The TOML configuration uses this format:
[mit.lint]
"lint-name" = true # or falsegit-mit loads authors from multiple sources and merges them:
-
From exec command (highest priority):
- Set via
--execflag orGIT_MIT_AUTHORS_EXECenvironment variable - The command output must be valid TOML or YAML format
- The command is executed using
shell_words::split()for proper argument parsing
- Set via
-
From authors file:
- Default location:
$HOME/.config/git-mit/mit.toml - Custom location via
--configflag orGIT_MIT_AUTHORS_CONFIGenvironment variable - Special handling for
$HOME/.config/git-mit/mit.tomlpath - it's expanded to the actual home directory - If the file doesn't exist, an empty string is used (no error)
- Default location:
-
From Git config:
- Authors stored in
mit.author.config.<initial>.*entries - These are set when you run
git mit-config mit set <initial> <name> <email> - Stored at repository level (local) or user level (global) based on
--scope
- Authors stored in
The authors from these sources are merged, with later sources overriding earlier ones if there are conflicts.
The installation process creates symbolic links to the git-mit binaries:
- Windows: Creates file symbolic links with
.exeextension - Unix/Linux/macOS: Creates standard symbolic links
- Existing hooks: Installation will fail if hooks already exist (unless they're already symlinks to git-mit)
- Symlink validation: If a symlink exists but points to the correct binary, installation succeeds silently
If you're still experiencing problems:
- Check for error messages: Run git commands with verbose output
- Verify Git version compatibility: Ensure you're using a recent version of Git
- Check for conflicting hook managers: Other tools like Husky or pre-commit might interfere
- File an issue: Visit the git-mit repository with details about your setup
For more help, consult: