starship: Slow loading big repos

Current Behavior

Hi, so I have problem, maybe connected to big repos, maybe to GitKraken. When I am using starfish for small repos, everything is smooth and fast, but when I am cd’ing into bigger repos I am getting this message: [WARN] - (starship::utils): Executing command β€œ/usr/bin/git” timed out. [WARN] - (starship::utils): You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing.

and it takes 5 secs, starship doesnt’ loads.

Expected Behavior

Fast loading dirs and starship for big repos

Additional context/Screenshots

Possible Solution

Environment

  • Starship version: 1.22.1
  • fish version: fish, version 3.7.1
  • Operating system: Mac OS 15.2.0
  • Terminal emulator: WarpTerminal v0.2025.01.22.08.02.stable_02
  • Git Commit Hash:
  • Branch/Tag:
  • Rust Version: rustc 1.84.0 (9fc6b4312 2025-01-07) (Homebrew)
  • Rust channel: release
  • Build Time: 2025-01-11 17:04:57 +00:00

Relevant Shell Configuration

# Loading all functions
for file in ~/.config/fish/functions/*.fish
    source $file
end

# Loading my functions
for file in ~/.config/fish/my_functions/*.fish
    source $file
end

alias pg_list "brew services list"
alias pg_stop_14 "brew services stop postgresql@14"
alias pg_stop_16 "brew services stop postgresql@16"
alias pg_start_14 "brew services start postgresql@14"
alias pg_start_16 "brew services start postgresql@16"
alias D "deactivate"
alias l 'fd -d 1 -u'
alias fs 'set selected_file (fzf --preview "cat {}"); test -n "$selected_file"; and bat "$selected_file"'
alias fle  "fl | fzf --preview 'echo {1} | cut -d \" \" -f 2 | help {2}'"
alias neo  'cmatrix'
alias usb  'cyme'
alias ut  'python -m unittest'
alias modified  "git status --short | grep '^ M' | awk '{print \$2}'"
alias untracked  "git ls-files --others --exclude-standard"
alias renamed  "git status --short | grep '^R' | awk '{print \$2 \" -> \" \$3}'"
alias deleted  "git status --short | grep 'D' | awk '{print \$2}'"
alias deleted  "git status --short | grep 'D' | awk '{print \$2}'"
alias s  "spf"
alias gbh  "battery_status"
alias mc  "sudo mactop"
alias cr  'code'
alias cre  'code .'
alias fish 'source ~/.config/fish/config.fish'
alias load_pyenv 'pyenv init - fish | source'
alias kb 'bat --color always ~/keyboard_shortcuts.txt'


abbr hide_file 'zip -er'
abbr rm sudo rm
abbr c4 c....
abbr c5 c.....
abbr fe "nvim (fzf --preview 'bat --color always {}' )"
abbr bi brew install
abbr se 'find . -name "**"'
abbr jq "jq '.'"
abbr y yazi
abbr gs 'git status'
abbr cs 'nvim ~/.config/fish/starship.toml'
abbr mosquitto /usr/local/sbin/mosquitto -v
abbr fb 'fzf --preview "bat --color always {}"'

# bun
set --export BUN_INSTALL "$HOME/.bun"
set --export PATH $BUN_INSTALL/bin $PATH

source $HOME/.cargo/env.fish
# homebrew in /opt - for arm64
#set -g PATH /opt/homebrew/bin $PATH

# Set OpenSSL environment variables for pyenv
set -gx LDFLAGS "-L$OPENSSL_PREFIX/lib"
set -gx CPPFLAGS "-I$OPENSSL_PREFIX/include"
set -gx PKG_CONFIG_PATH "$OPENSSL_PREFIX/lib/pkgconfig"
if test -f ~/.fish_secrets
    source ~/.fish_secrets
end

# Prioritize x86_64 Homebrew
set -gx PATH /usr/local/bin $PATH
set -gx WGPU_BACKEND "gl"
# Added by Windsurf
fish_add_path /Users/mateuszormianek/.codeium/windsurf/bin

Starship Configuration

# ~/.config/starship.toml

# Global Settings
format = "πŸš€$directory$git_branch$git_status 󱦰 "
right_format = "$aws$python$time"

add_newline = false
command_timeout = 4000  # Timeout in milliseconds

[aws]
format = '[$symbol ($profile)]($style)'
symbol = "☁️ "

[line_break]
disabled = false

[python]
format = "[ ($virtualenv )$symbol($version)]($style)"
symbol = "🐍 "

[directory]
format = "[$path ]($style)"
truncation_length = 1
truncate_to_repo = false
use_logical_path = true
style = "#C1E3FE"

[git_branch]
symbol = ""
truncation_length = 30
truncation_symbol = "…"
format = '[$symbol $branch]($style)'

[git_status]
format = "[$ahead_behind$modified$untracked$stashed$conflicted$renamed$deleted]($style)"
conflicted = " 🚩"
ahead      = " 🌟"
behind     = " 🐌"
diverged   = " 🚧"
untracked  = " πŸ‘€"
stashed    = " πŸ“¦"
modified   = " πŸ› οΈ"
renamed    = " πŸ‘…"
deleted    = " πŸ—‘"

[time]
disabled = false
time_format = "%R" # Hour:Minute Format
format = '[ $time ]($style)'

[character]
success_symbol = '[ ➜](#4c566a)'
error_symbol = '[ ➜](bold red)'


# Disable slow or unused modules
[battery]
disabled = true


About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 3
  • Comments: 26 (3 by maintainers)

Commits related to this issue

Most upvoted comments

For the most part, you dont really tune the git repo, but your general gitconfig. Those are the ones that can make the most difference. Primarily the fsmonitor one. If not doing anything, try making sure you have watchman installed and are being used.

Enabling fsmonitor will can also force starship to use the git-cli backend for git-status. If core.fsmonitor is true, the git index is sparse, or if git_status.use_git_executable is true starship will fall back to the git-cli instead of the gitoxide backend introduced in v1.23, which is usually faster.

Someone changed the implementation and has improved performance in the newest version 1.23

There are plenty of recommendations in this thread, you can try them to see if helps before disabling.

I see. But true are not available on linux.

Starship can show module timings via starship timings. To benchmark the whole prompt execution, please try to benchmark starship prompt or starship module module_name for individual modules (this may not work if the module is disabled). The git_branch shouldn’t execute the git-cli.

Yes, disabling git status and git branch makes everything faster.

This command seems to give the approx delay.

starship explain

Not sure if takes git into account.


You can try disabling the git configurations one by one and see if there is any difference in between. That could help tell if the problem are with starship or not.


While not a solution, it could help https://www.git-tower.com/blog/git-performance/