Search code examples
linuxgitincludecode-organizationgit-config

Using INCLUDE for git config


In the question regarding Changing .gitconfig location on Windows, Joe Brinkman gave this answer, https://stackoverflow.com/a/37755334/9486497.

For users whom have a network directory declared as their $HOME directory by their organization, his answer seems to be the most logical, in the sense that it works with the Git tool without attempting to redefine an environment variable (which many users will not have Administrator rights to accomplish).

How does one properly utilize the INCLUDE tool in Git to point the .gitconfig file to another location? My code:

[include]
path = c:\users\userid\.mygitconfig

When I go to check that it works i get a fatal: bad config line 2 in file H://.gitconfig error.


Solution

  • I figured out that my code was a syntactical error. Due to the GitBash environment's LINUX base. LINUX uses forward slashes in pathing while Windows copy/paste, which I used, has back slashes. INCORRECT :

    [include]
    path = c:\users\userid\.mygitconfig
    

    Should have been :

    [include]
    path = c:/users/userid/.mygitconfig