147

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
  • 27,102
  • 64
  • 169
  • 262
  • 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

198

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,254
  • 18
  • 26
cdhowie
  • 144,362
  • 22
  • 272
  • 285
182

You don't need to find the file.

Only write this instruction on terminal:

git config --global --edit
bpedroso
  • 3,976
  • 3
  • 27
  • 33
  • 11
    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
  • 2
    This should NOT be the top answer because it doesn't answer the question. – Skip Jun 30 '20 at 20:33
  • 1
    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
  • 2
    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

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
  • 4
    this works for me -> shift + ⌘ + . – Jeremy Lake May 09 '18 at 09:11
2

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,685
  • 7
  • 32
  • 58