How to set a local .gitconfig file from my repo for use with local git-aliases

32 Views Asked by At

Good day all,

I create a local git config file on my Windows drive. For the sake of simplicity, let's say that the full file path is: H://neverAgain/dongle/.gitconfig

Note: the home directory for the local git repo is located at "H://neverAgain".

I type the command: git config --file "H://neverAgain/dongle/.gitconfig

to point to the local config file for my git aliases. Whenever I do that, I keep getting the long git config usage notification:

usage: git config [<options>]

Config file location
    --[no-]global         use global config file
    --[no-]system         use system config file
    --[no-]local          use repository config file
    --[no-]worktree       use per-worktree config file
    -f, --[no-]file <file>
                          use given config file
    --[no-]blob <blob-id> read config from given blob object

Action
    --[no-]get            get value: name [value-pattern]
..........
Other
    -z, --[no-]null       terminate values with NUL byte
    --[no-]name-only      show variable names only
    --[no-]includes       respect include directives on lookup
    --[no-]show-origin    show origin of config (file, standard input, blob, command line)
    --[no-]show-scope     show scope of config (worktree, local, global, system, command)
    --[no-]default <value>
                          with --get, use default value when missing entry

I shortened the full message for the post. That said, what do I still need to point to my local file?

Expected Result: I created a local git config file and I tried using both git config -f and git config --file to point to the local git config, so that typing git config --local alias.st status will set the alias to the local file.

I was expecting for either one of the commands to work, which would allow me to verify the git config command by viewing the alias in the local config file.

Thank you in advance!

0

There are 0 best solutions below