windows


Git 2.13 conditional config on windows


Git version: 2.13.0.windows.1
OS: Windows 7
CLI: Git bash
.gitconfig
[user]
name = Gyandeep Singh
email = private#email.com
[push]
default = current
[core]
autocrlf = input
[includeIf "gitdir: ~/Documents/webstorm/corporate/"]
path = .gitconfig-work
.gitconfig-work
[user]
name = Gyandeep Singh
email = corporate#email.com
Both the config files above sit together in the same directory (home).
What happened: open CLI on a folder (example test) inside corporate folder and then run git config user.email the output is private#email.com.
Expected: Outcome should be corporate#email.com.
Am I doing something wrong or my expectation is not correct? I did follow the git docs.
Solution
You have to run git config --show-origin --get user.email on a git initialized directory. If its not git initialized then the includeIf gitdir functionality will not work.
Its strange but true. I wish it still worked.
Your global C:/Users/<user-name>/.gitconfig should have this includeIf:
[includeIf "gitdir:C:/Users/<user-name>/Documents/webstorm/corporate/"]
path = .gitconfig-work
with having your work Git repos in C:/Users/<user-name>/Documents/webstorm/corporate and the conditional work configuration should be located at C:/Users/<user-name>/.gitconfig-work.
That's at least working for me in Window's cmd and Cmder. A git config --show-origin --get user.email should than show you from where a config value is loaded/resolved.
It also seems like the conditional work configuration is only used when issued from within a Git repository.
C:\Users\<user-name>\Documents\webstorm\corporate
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig foo#oss.com
C:\Users\<user-name>\Documents\webstorm\corporate\some-repo
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig-work foo#company.com
C:\Users\<user-name>\Documents\webstorm\corporate\some-non-repo-dir
λ git config --show-origin --get user.email
file:C:/Users/<user-name>/.gitconfig foo#oss.com

Related Links

QFile::copy returns true even though copy failed in Windows
How do I check the permission of a registry key from the command line? [closed]
What does $c mean in a Windows Directory?
Need help using tasklist to check if the Battle.net process
Inno Setup refuses to set permissions of some files
Render Local Report to EMF distorts on Windows Server 2008 R2 Enterprise
How can I run script files by their shortcuts in Windows?
Why is AWS-ConfigureWindowsUpdate SSM Run Command Failing?
ECDH (256 bit key), Create Private Key from X component
Exporting device manager to a txt file
Asterisk upload recorded calls to Filezila ftp server with 550 error
Why can't running exes and loaded dlls be deleted on Windows?
ld.exe can't find libraries during cabal-install (Haskell Platform)
Syntax to create a Windows Service
How to disable all actions in delphi form
How to Select all text in VBS?

Categories

HOME
batch-file
embedded
microsoftgraph
adal
gdb
awk
polymer
jmeter
gpu
graphics
pclxl
alarm
big-o
onclick
x264
pkcs#11
bing-maps
jquery-ui-sortable
siddhi
favicon
linear-algebra
intershop
sse
cfml
nim
windows-xp
lilypond
googlebot
poedit
pagespeed
dapper-extensions
pic32
motion-detection
amazon-quicksight
nsurl
turfjs
angularjs-material
pop3
getlasterror
python-pptx
apic
graphhopper
flatmap
connection-pool
password-protection
azure-arm
postgresql-8.4
parser-generator
preloader
plr
jide
nanoc
magento-2.0.7
user-defined-fields
corruption
scalding
android-testing
skin
rsa-archer-grc
renaming
envi
hadoop-partitioning
boomerang
computer-architecture
phonertc
cgi-bin
.bash-profile
android-broadcast
dot.js
code-documentation
filesplitting
genymotion-call
build-script
mintty
malformedurlexception
cfcache
ecslidingviewcontroller
ora-06550
hibernate-entitymanager
inputmismatchexception
flex++
virtual-pc
web-notifications
lambdaj
multiplexing
apache-commons-dbutils
procedures
screen-size
drawtobitmap
quotation-marks
squishit
skype4java
wcf-instancing
sun
dsoframer

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App