gpt4 book ai didi

windows - Git 配置文件 : Best practice

转载 作者:行者123 更新时间:2023-12-02 15:12:40 25 4
gpt4 key购买 nike

我设法以某种方式让 Git 与 Github 一起运行,现在(一年后)我想教小组他们如何做同样的事情。我从 here 中学到了很多东西,但即使有了答案,有些事情仍不清楚。如果我没有从 git reference 得到它,请道歉

问题:

  • 是否有最佳实践,哪些参数应该显示在哪个配置文件中?

...继续我下面的例子:

  • 我标记了可以通过--system--global--local 访问的部分。有人知道第一部分属于哪里吗?
  • 绿色就是一切,在我认为还可以的地方(以我非常有限的知识)。
  • 红色很奇怪,因为它出现了两次

当我运行 git config --list --show-origin 时,我得到以下结果:

enter image description here

编辑@Code-Apprentice:
来自 git-bash

$ git config --list --show-origin --system
file:"C:\\Git\\mingw64/etc/gitconfig" credential.helper=manager

和命令

>git config --list --show-origin --system
file:"C:\\Git\\mingw64/etc/gitconfig" credential.helper=manager

Git 输出为代码:

file:"C:\\ProgramData/Git/config"       core.symlinks=false # ... see .git/config 
file:"C:\\ProgramData/Git/config" core.autocrlf=true
file:"C:\\ProgramData/Git/config" core.fscache=true
file:"C:\\ProgramData/Git/config" color.diff=auto
file:"C:\\ProgramData/Git/config" color.status=auto
file:"C:\\ProgramData/Git/config" color.branch=auto
file:"C:\\ProgramData/Git/config" color.interactive=true
file:"C:\\ProgramData/Git/config" help.format=html
file:"C:\\ProgramData/Git/config" http.sslcainfo=C:/Git/mingw64/ssl/certs/ca-bundle.crt
file:"C:\\ProgramData/Git/config" diff.astextplain.textconv=astextplain
file:"C:\\ProgramData/Git/config" rebase.autosquash=true

file:"C:\\Git\\mingw64/etc/gitconfig" credential.helper=manager # ... see file:C:/Users/myname/.gitconfig

file:C:/Users/myname/.gitconfig filter.lfs.clean=git-lfs clean %f
file:C:/Users/myname/.gitconfig filter.lfs.smudge=git-lfs smudge %f
file:C:/Users/myname/.gitconfig filter.lfs.required=true
file:C:/Users/myname/.gitconfig user.name=My name
file:C:/Users/myname/.gitconfig user.email=my.name@domain.com
file:C:/Users/myname/.gitconfig credential.helper=wincred
file:C:/Users/myname/.gitconfig alias.hist=log --pretty=format:'%h - %an, %ad: %s' --graph --date=short
file:C:/Users/myname/.gitconfig difftool.kdiff3.cmd='C:/Program Files/KDiff3/kdiff3' $LOCAL $REMOTE
file:C:/Users/myname/.gitconfig difftool.kdiff3.keepbackup=false
file:C:/Users/myname/.gitconfig difftool.kdiff3.trustexitcode=false
file:C:/Users/myname/.gitconfig merge.conflictstyle=diff3

file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=false
file:.git/config core.bare=false
file:.git/config core.logallrefupdates=true
file:.git/config core.symlinks=false
file:.git/config core.ignorecase=true
file:.git/config core.hidedotfiles=dotGitOnly
file:.git/config remote.origin.url=https://github.com/repo/Rettung-ZCH
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config branch.master.remote=origin
file:.git/config branch.master.merge=refs/heads/master
file:.git/config branch.dev1.remote=origin
file:.git/config branch.dev1.merge=refs/heads/dev1
file:.git/config branch.dev2.remote=origin
file:.git/config branch.dev2.merge=refs/heads/dev2

最佳答案

  • Is there a best practice, which parameters should show up in which config file?

这完全取决于您,无论您是只想在一个存储库上设置,还是在您使用用户帐户访问的所有存储库上,还是在这台机器上的所有存储库上设置(当然,每次都只有在未从较低配置级别覆盖的情况下) ).

  • I marked the parts which I can access via --system, --global and --local. Does anybody know where the first part belongs to?

据我所知,这些是 Git for Windows 客户端的默认值,并且处于(或更确切地说高于)系统设置级别。您可以使用 git config --file c:\ProgramData\Git\config --list 等列出和更改它们。

  • Green is everything, where I think, it is ok (with my very limited knowledge).

正如我所说,完全取决于您。本地绿色设置很可能只在本地有用,是的。例如,对我而言,user.email 并未在我的工作箱中设置为全局级别,因为我处理私有(private)和公司 repo 并在那里使用不同的地址。通过不在全局级别配置任何一个,我被提醒在本地级别进行第一次提交时设置它。

  • Red is strange as it exists twice

你可以在每一层都有每一个设置,下层覆盖上层的值,这是完全合法的。你可以G。为系统上的所有用户设置为使用 credential.helper=manager 但为您的用户设置为使用 credential.helper=wincred 就像您在示例中那样。

关于windows - Git 配置文件 : Best practice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42675999/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com