如何在 Mac 中定位 git 配置文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16283280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 16:03:16  来源:igfitidea点击:

How to locate the git config file in Mac

gitmacos

提问by lakesh

As title reads, how to locate the git config file in Mac? Not sure how to find it. Need to set

如标题所示,如何在 Mac 中找到 git 配置文件?不知道如何找到它。需要设置

git config --global http.postBuffer 524288000

Need some guidance on finding it..

需要一些指导才能找到它。

回答by cdhowie

The global Git configuration file is stored at $HOME/.gitconfigon all platforms.

全局 Git 配置文件存储在$HOME/.gitconfig所有平台上。

However, you can simply open a terminal and execute git config, which will write the appropriate changes to this file. You shouldn't need to manually tweak .gitconfig, unless you particularly want to.

但是,您可以简单地打开终端并执行git config,这会将适当的更改写入此文件。您不需要手动调整.gitconfig,除非您特别想要。

回答by bpedroso

You don't need to find the file.

您不需要找到该文件。

Only write this instruction on terminal:

只在终端上写这个指令:

git config --global --edit

回答by user3718742

I use this function which is saved in .bash_profile and it works a treat for me.

我使用保存在 .bash_profile 中的这个函数,它对我来说是一种享受。

function show_hidden () {
        { defaults write com.apple.finder AppleShowAllFiles ; killall -HUP Finder; }
}

How to use:

如何使用:

show_hidden true|false 

回答by Ankit Tanna

The solution to the problem is:

问题的解决方法是:

  1. Find the .gitconfigfile

  2. [user] name = 1wQasdTeedFrsweXcs234saS56Scxs5423 email = [email protected] [credential] helper = osxkeychain [url ""] insteadOf = git:// [url "https://"] [url "https://"] insteadOf = git://

  1. 找到.gitconfig文件

  2. [user] name = 1wQasdTeedFrsweXcs234saS56Scxs5423 email = [email protected] [credential] helper = osxkeychain [url ""] insteadOf = git:// [url "https://"] [url "https://"] insteadOf = git://

there would be a blank url=""replace it with url="https://"

会有一个空白的url=""替换为url="https://"

[user]
    name = 1wQasdTeedFrsweXcs234saS56Scxs5423
    email = [email protected]
[credential]
    helper = osxkeychain
[url "https://"]
    insteadOf = git://
[url "https://"]
[url "https://"]
    insteadOf = git://

This will work :)

这将工作:)

Happy Bower-ing

快乐凉亭