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

How to change the behavior of git status showing modified files which are eventually not committed?
IIS Bindings - Easiest Backup and Restore
How to get token of logged-in user from within windows service with C++?
Unable to Write Inline function in Matlab [closed]
How do you write to the syswow64 folder in Win10? [closed]
Team City: Cannot Redeploy to Tomcat7
Git Windows acting funky
Batch to PowerShell Language Conversion
Why have Live tiles stopped working for my website?
Can we Create Smart Device Project in VIsual Studio 2015 Professional
Excel VBA: Is it possible to retrieve a users windows network password via VBA?
CUDA, Win7, Qt Creator - LNK1104: cannot open file '<cuda file>.obj'
Nsis Script : Reading from registry key value in NSIS script fails
Failed attempt to compress pdf with ghostscript - Device 'pdfwrite' requires output file
Windows 8.1 Universal App Multitasking Foreground-Background Cycle
What is windows CE OS ? How to install it from scrach on blank HDD?

Categories

HOME
microsoftgraph
porting
api
spark-streaming
gdb
nvd3.js
pyqt
angular2-material
rsa
battery
devise
gradient
grafana
entity-framework-core
web-hosting
python-multithreading
google-admin-sdk
accessibility
mql5
owin
minecraft-forge
fhir
forgot-password
google-data-studio
digital-signature
sse
drive
visual-glitch
squashfs
jquery-ias
joptionpane
scriptella
zxing
gmock
xcode-ui-testing
surveymonkey
mat
nstimer
intersystems-cache
tizen-tv
testcomplete
userdefaults
mobx
login-script
classcastexception
installscript
hivemq
sim-toolkit
wurfl
xcode7.3
graphhopper
z-notation
kill
odoo-website
movilizer
opencmis
getchar
xbmc
netbeans6.8
git-flow
cup
swingworker
angular2-testing
phpwebsocket
ascii-art
rasterize
fuelcms
visual-sourcesafe-2005
canalyzer
ember-cli-rails
omnifaces
zend-currency
code-documentation
procedural-programming
document-repository
angular-gettext
rickshaw
entry-point
unix-socket
maven-scm
embedded-fonts
beaker-testing
nevron
frameworkelementfactory
qtconcurrent
vfs
subproject
objectquery
ilasm
kqueue
procedures
catransform3d
quotation-marks
luajava
commerceserver2007
squishit
globals
hbm2java
burndowncharts
lalr
technical-debt
business-model

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