乐闻世界logo
搜索文章和话题

How do i show my global git configuration

2个答案

1
2

When you want to query all global Git configurations on your current computer, you can use the following Git command:

bash
git config --global --list

This command lists all global configurations stored in the .gitconfig file within your user's home directory. For example, it displays user name, email, diff tools, and aliases.

If you want to view a specific global setting, you can use the following commands:

bash
git config --global user.name git config --global user.email

These commands respectively show the user name and email configured globally.

For instance, if you have set up global configurations on your machine—such as your user name and email, and aliases for common commands—executing git config --global --list might produce the following output:

plaintext
user.name=John Doe user.email=johndoe@example.com alias.st=status alias.co=checkout alias.br=branch alias.ci=commit

In this output, you can see the user name is "John Doe", the email is "johndoe@example.com", and several command aliases are defined, such as using st instead of status and co instead of checkout.

2024年6月29日 12:07 回复

Starting from Git 2.26.0, you can use the --show-scope option:

bash
git config --list --show-scope

Output example:

text
system rebase.autosquash=true system credential.helper=helper-selector global core.editor='code.cmd' --wait -n global merge.tool=kdiff3 local core.symlinks=false local core.ignorecase=true

It can be used with:

  • --local for project configuration, --global for user configuration, and --system for system-wide configuration
  • --show-origin to show the exact location of the configuration file
2024年6月29日 12:07 回复

你的答案