183

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

git config --global http.postBuffer 524288000

Need some guidance on finding it..

lakshmen
  • 28,346
  • 66
  • 178
  • 276
  • 1
    There are actually multiple config files for git, they work in a hierarchy: `system`, `global`, `local`, `worktree` and `file`. Checkout this link from gitlab docs https://git-scm.com/docs/git-config#FILES – Touten Aug 03 '20 at 02:59

4 Answers4

237

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

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.

AndyO
  • 1,512
  • 20
  • 28
cdhowie
  • 158,093
  • 24
  • 286
  • 300
233

You don't need to find the file.

Only write this instruction on terminal:

git config --global --edit
bpedroso
  • 4,617
  • 3
  • 29
  • 34
  • 14
    this should really be the top answer. typing vim ~/.gitconfig wanted to create a new file when my gitconfig already existed – heug Sep 06 '18 at 21:56
  • This worked for me since gitconfig file was not visible on Mac – AskQ Aug 02 '19 at 07:13
  • @AskQ maybe you dont have any gitconfig. You can create a file .gitconfig on ~ or any other place in your development path – bpedroso Aug 02 '19 at 13:55
  • 3
    This is such a great answer, I used `git config --system --edit` to find the location of the system config which was in /usr/local/etc/gitconfig in my case. I had no Idea to look there. (opens the file in vim then `1` followed by `control + g` shows the path of the file) – Touten Aug 03 '20 at 02:54
  • In case anyone, such as me, can't make heads or tails of the terminal editor, you can use VS Code pointed at /Users/ and find .gitconfig in the Explorer window. – John Mc Aug 04 '21 at 22:12
  • 4
    You can use `git config --global core.editor "your-editor"` command, as it says in the git [documentation](https://git-scm.com/book/en/v2/Appendix-C%3A-Git-Commands-Setup-and-Config). After that `git config --global --edit` command will open `.gitconfig` file in your code editor. – Denkhis Apr 27 '22 at 13:52
3

The solution to the problem is:

  1. Find the .gitconfig file

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

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

[user]
    name = 1wQasdTeedFrsweXcs234saS56Scxs5423
    email = ankittanna@hotmail.com
[credential]
    helper = osxkeychain
[url "https://"]
    insteadOf = git://
[url "https://"]
[url "https://"]
    insteadOf = git://

This will work :)

Happy Bower-ing

Ankit Tanna
  • 1,779
  • 8
  • 32
  • 59
3

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

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

How to use:

show_hidden true|false 
  • as an **alternative** you can also do this :** `alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'` AND
    `alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'`. then to use simply type in console : `showFiles` or `hideFiles`
    – DaddyMoe Sep 21 '15 at 13:14
  • 5
    this works for me -> shift + ⌘ + . – Jeremy L May 09 '18 at 09:11