gitbutlerapp/gitbutler · warning

Could not detect your shell configuration file

Error message

Could not detect your shell configuration file

What it means

print_fallback_setup_instructions in shell.rs is the installer's fallback when no supported shell configuration file could be detected. It warns 'Could not detect your shell configuration file' and then prints integration snippets for bash, zsh, and fish so the user can wire up the 'but' command manually.

Solutions

  1. Follow the printed snippets: add the shown lines to ~/.bashrc, ~/.zshrc, or your fish config manually, then restart the shell.
  2. Set $SHELL or create the expected config file (`touch ~/.bashrc`) and re-run the installer so detection succeeds.
  3. If you use an unsupported shell, replicate the integration (PATH entry/alias) using that shell's own config mechanism.

Example fix

# before: installer prints fallback instructions
# after: create the config and re-run
$ touch ~/.zshrc && ./but-installer
$ exec zsh
Defensive patterns

Strategy: fallback

Validate before calling

# Check detection prerequisites before installing.
echo "SHELL=$SHELL"; ls ~/.bashrc ~/.zshrc ~/.config/fish/config.fish 2>/dev/null

Try / catch

// No exception is thrown; handle the fallback by applying the printed snippet.
const shellCfg = ['~/.bashrc', '~/.zshrc', '~/.config/fish/config.fish'].find(exists);
if (!shellCfg) {
  applySnippetManually('bash'); // copy the installer's printed lines into a config
}

Prevention

When it happens

Trigger: configure_shell -> print_fallback_setup_instructions, when shell detection finds none of the supported shells' config files (e.g. $SHELL unset and no ~/.bashrc, ~/.zshrc, or fish config present).

Common situations: Minimal containers/CI images with no dotfiles; users of shells without first-class support (nushell, powershell, csh) on a machine lacking bash/zsh/fish configs; freshly provisioned accounts that never launched a shell.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/cf989221c9132863. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-installer/src/shell.rs:323

            ));
            info("Please add the following lines to your shell config file manually:");

            if needs_path {
                ui::println(&format!("  {path_cmd}"));
            }
            if needs_completions {
                ui::println(&format!("  {completion_cmd}"));
            }
        }
    }

    Ok(())
}

/// Instructions to print if we cannot detect any supported shells
fn print_fallback_setup_instructions() {
    ui::println_empty();
    warn("Could not detect your shell configuration file");

    for shell in [ShellType::Bash, ShellType::Zsh, ShellType::Fish] {
        ui::println_empty();
        info(&format!(
            "For {}, add the following to your config:",
            shell.name()
        ));
        for line in ShellConfig::empty_config(shell).generate_missing_shell_config_lines() {
            ui::println(&format!("  {line}"));
        }
    }
}

#[cfg(test)]
mod tests {

    use super::*;

View on GitHub (pinned to 58e5313667)