{"id":6923,"date":"2019-04-14T15:18:59","date_gmt":"2019-04-14T15:18:59","guid":{"rendered":"http:\/\/putridparrot.com\/blog\/?p=6923"},"modified":"2019-04-14T15:18:59","modified_gmt":"2019-04-14T15:18:59","slug":"gitconfig-the-where-and-hows","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/gitconfig-the-where-and-hows\/","title":{"rendered":"gitconfig, the where and how&#8217;s"},"content":{"rendered":"<p>The git configuration files are stored at three different levels. <\/p>\n<p><strong><em>Local<\/em><\/strong> are stored within the cloned repository&#8217;s .git folder and the file is named config. <\/p>\n<p><strong><em>Global<\/em><\/strong> is stored in a file with no name and with the extension .gitconfig. It&#8217;s stored in your home directory. On Windows this can be confusing especially if the home directory is in a roaming profile. For example, normally we&#8217;d find the it in c:\\users\\your-user-name, however if you have a roaming profile then you&#8217;ll need to check <\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\nHOME=&quot;$HOMEDRIVE$HOMEPATH&quot;\r\n<\/pre>\n<p>So for example this might end up as H:\\<\/p>\n<p><strong><em>System<\/em><\/strong> is stored as gitconfig (filename but no extension). In the case of a Windows OS, this will be in C:\\Program Files\\Git\\mingw64\\etc, further configuration data may be found in the config file (filename but no extension) within C:\\ProgramData\\Git.<\/p>\n<p><strong>Scope<\/strong><\/p>\n<p>The scope of these files is as follows, <em>local<\/em> overrides <em>global<\/em> options and <em>global<\/em> overrides <em>system<\/em>.<\/p>\n<p><strong>List the configurations<\/strong><\/p>\n<p>If you execute the command below, you&#8217;ll see a list of all the configuration along with the location of the files used.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\ngit config --list --show-origin\r\n<\/pre>\n<p><em>Note: beware if passwords are stored in the configuration then these will be displayed when you run this command.<\/em><\/p>\n<p>The command does not show you what&#8217;s &#8220;actually&#8221; being used for configuration from the current repo. so much as &#8220;here&#8217;s all the configuration values&#8221;, so you&#8217;ll need to look at the scope of each file to determine what values are currently being used by git.<\/p>\n<p>We can also use the same command along with the switch <em>&#8211;local<\/em>, <em>&#8211;system<\/em> and <em>&#8211;global<\/em> to list the files used along with the configuration used.<\/p>\n<p><strong>Further reading<\/strong><\/p>\n<p><a href=\"https:\/\/git-scm.com\/docs\/git-config\" rel=\"noopener noreferrer\" target=\"_blank\">git-config<\/a><br \/>\n<a href=\"https:\/\/www.atlassian.com\/git\/tutorials\/setting-up-a-repository\/git-config\" rel=\"noopener noreferrer\" target=\"_blank\">git config (Atlassian)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The git configuration files are stored at three different levels. Local are stored within the cloned repository&#8217;s .git folder and the file is named config. Global is stored in a file with no name and with the extension .gitconfig. It&#8217;s stored in your home directory. On Windows this can be confusing especially if the home [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[206],"tags":[],"class_list":["post-6923","post","type-post","status-publish","format-standard","hentry","category-git-2"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6923","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=6923"}],"version-history":[{"count":5,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6923\/revisions"}],"predecessor-version":[{"id":6938,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/6923\/revisions\/6938"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=6923"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=6923"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=6923"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}