如何显示我的全局Git配置?

1641

我希望显示所有配置的Git部分。

我只找到了git config --get core.editor,我想要输出全局配置的所有内容,而不仅仅是配置的默认编辑器。


3
查看.gitconfig有什么问题? - Rook
2
请注意,你很快就能(在2015年第三季度/第四季度)通过 git 2.6 的选项 --name-only 列出配置键,而不包括它们的值。请见下面的我的回答 - VonC
78
你可以通过输入 $ git config --list 命令来检查你的 Git 配置设置。更多信息请参考 Checking-Your-Settings - TarranJones
19
这里更深入地解释了,应该使用git config --global --list - prosti
15个回答

8

如果你只想列出Git配置的部分,例如别名(alias)核心(core)远程(remote)等,可以通过grep命令来过滤结果。像这样:

git config --global -l | grep core

8
要轻松显示全局Git配置,请使用以下命令:
  • git config --global --list 显示所有配置的列表。
  • git config --global --get user.name 显示您的用户名。
  • git config --global --get user.email 显示您的电子邮件。
  • git config --global credential.helper 验证凭据。
  • git config --global gui.recentrepo 查找最近的存储库。

您可能需要指定要读取这些配置的位置,只需添加级别选项:

  1. --system:系统级别适用于系统上的每个用户及其所有存储库。
  2. --global:全局级别的值专门针对您个人而设。
  3. --local:存储库级别具有特定于该单个存储库的设置。

5

要找到所有的配置,只需输入以下命令:

git config --list

我在本地运行了这个命令。

Md Masud@DESKTOP-3HTSDV8 MINGW64 ~
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
user.email=infomasud@gmail.com
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
filter.lfs.clean=git-lfs clean -- %f

git config 命令是一个方便的函数,用于在全局或本地项目级别上设置 Git 配置值。这些配置级别对应于 .gitconfig 文本文件。在此处阅读更多信息:https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-config - infomasud
太好了,你能把那个加到你的回答里吗? - RamenChef

4

在基于Linux系统上,您可以通过以下方式查看/编辑配置文件:

vi/vim/nano .git/config

请确保您位于Git初始化文件夹中。

如果您想使用--global config操作,请注意:

vi/vim/nano .gitconfig

在/home/userName上

这应该有助于编辑:https://help.github.com/categories/setup/


2

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接