我想知道如何更改命令的内容git config --list?我将从GitHub中提取/分叉存储库.我将在我的Windows,Linux和Mac工作站上配置这样的存储库.
谢谢.
小智 50
如果要设置特定于特定存储库的配置,可以使用两个选项,从命令行进行配置,或在编辑器中编辑repo的配置文件.
使用简单的命令行,cd进入你的Git库的根目录,并运行git config,无需将--system和--global标志,它们分别是配置您的计算机和用户的Git设置:
cd <your-repo>
git config <setting-name> <setting-value>
git config <setting-name>=<setting-value> # alternate syntax
Run Code Online (Sandbox Code Playgroud)
您的另一个选择是直接编辑repo配置文件.使用默认的Git克隆,它通常是.git/configrepo的根文件夹中的文件.只需在编辑器中打开该文件并开始添加设置,或使用命令行调用其编辑器git config --edit.
您可以在官方Linux Kernel Git文档中git config了解有关配置Git的更多信息.特别是,您可能有兴趣看到一个示例Git配置:
# Core variables
[core]
; Don't trust file modes
filemode = false
# Our diff algorithm
[diff]
external = /usr/local/bin/diff-wrapper
renames = true
[branch "devel"]
remote = origin
merge = refs/heads/devel
# Proxy settings
[core]
gitProxy="ssh" for "kernel.org"
gitProxy=default-proxy ; for the rest
[include]
path = /path/to/foo.inc ; include by absolute path
path = foo ; expand "foo" relative to the current file
path = ~/foo ; expand "foo" in your $HOME directory
Run Code Online (Sandbox Code Playgroud)
解决原始海报关于如何更改user.name和user.email每个存储库的问题,以下是如何通过命令行执行此操作.切换到每个存储库,然后运行以下命令:
git config user.name "<name>"
git config user.email "<email>"
Run Code Online (Sandbox Code Playgroud)
由于您没有使用--system或--global标志,上述命令将仅适用于终端工作目录中的任何回购.
| 归档时间: |
|
| 查看次数: |
21345 次 |
| 最近记录: |