Skip to content

Instantly share code, notes, and snippets.

@ulrich
Last active January 9, 2023 10:16
Show Gist options
  • Save ulrich/3fbbfe9af21d66e444a973eccf66c710 to your computer and use it in GitHub Desktop.
Save ulrich/3fbbfe9af21d66e444a973eccf66c710 to your computer and use it in GitHub Desktop.

Add Starship custom module to display Git user and signkey

If you want to print the git user/singkey for a local repository in the prompt:

Edit the ~/.config/starship.toml file.

[custom.gituser]
style = "bold fg:220"
detect_folders = ['.git']
format = 'git:[$output]($style)'
command = 'git config -z --get user.email && echo -n "#" && git config --get user.signingkey | cut -c -4'

Will display:

❯ kub:foo@snap in bar on  develop [!] is 📦 v1.2.0-SNAPSHOT via ☕ v17 git:uvachon@gmail.com#BABE
@ulrich
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment