How can I make a Git command temporarily ignore my ~/.gitconfig
?
I can set GIT_CONFIG=/dev/null
to make git config
ignore ~/.gitconfig
, but this doesn't affect other Git commands.
I can hide my ~/.gitconfig
, e.g. mv ~/.gitconfig{,.hidden}
, but this is annoying since I have to move it back later and it affects Git globally.
If you set core. filemode=false then git will ignore execute bit changes, no need to change local permissions. Unless you've already added permission changes to the index, in which case you're missing the step where you would need to git add after you turn off core.
If you want to ignore certain files in a repository locally and not make the file part of any repository, edit . git/info/exclude inside your repository.
The git config command is a convenience function that is used to set Git configuration values on a global or local project level. These configuration levels correspond to . gitconfig text files. Executing git config will modify a configuration text file.
core.ignoreCase. If true, this option enables various workarounds to enable Git to work better on filesystems that are not case sensitive, like FAT. For example, if a directory listing finds "makefile" when Git expects "Makefile", Git will assume it is really the same file, and continue to remember it as "Makefile".
I found a decent workaround: Git can't use my ~/.gitconfig
if it can't find it:
HOME= git <args>
works! Here HOME=
effectively unsets HOME
for the duration of the command git <args>
.
More careful but longer versions include
HOME=/dev/null git <args>
and
(unset HOME; git <args>)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With