SourceTree commits with a different author name and email


When I Commit from SourceTree it commits 
With an Author and Email different from what I have configured 

Because I dont want to share my actual Email I will use an example that is identical 

Lets say I have configured git as follows

 git config --global "Doe"
 git config --global

When I commit from the command line or GitHub Desktop 
The commits are assigned to the correct Author Name and Email exactly as Configured

When I commit from SoureTree, it commits as 
"John Doe" and

So it changes the spelling of my Author Name and the Email Domain of my email, by adding INC

Now what is also weird, is that everywhere in SourceTree it only have the correct the one
Even in the commit section

I dont know what drive SourceTree to modify them the mometn it commits 
I googled this extensively 
I uninstalled SourceTree, deleted all the folders for Atlassian and SourceTree from the user folder (before reinstalling), I checked all the setting 

Somehow SourceTree still manage to remember the wrong Author Name and Email 

This is driving me a bit crazy, I tried everything I found online, nothing work, this is probably a deep bug in sourcetree
And it is concerning, since I dont know how else SourceTree could be changing things behind my back 

2 answers

1 accepted

0 votes
Answer accepted

I figured out what the issue, possibly a bug, was exactly 

1. My HOMEDRIVE environment variable, points to network drive
2. If I am connected to the work network, .gitconfig gets created under my HOMEDRIVE env variable location
3. If I am working offline (i.e. not connected to work network) my .gitconfig  get created is the folder from the USERPROFILE env variable 
4. If you try to commit while a .gitconfig is missing, git will still commit and give you this warning " ... Your name and email address were configured automatically based on your username and hostname. ...."
5. The issue with ST is that the command line and all the tools were able to read from the .gitconfig under my USERPROFILE folder, while I am offline, only ST would treat it as missing 
6. What is even weirder, is that every else in ST like in options screens and changes screen, ST was able to read it fine, only while commiting would it behave like the file is completely missing 

So the best solution i found which seem to fix all, was to set the env variable
GIT_CONFIG_GLOBAL to point to the .gitconfig under USERPOFILE 

[System.Environment]::SetEnvironmentVariable('GIT_CONFIG_GLOBAL', $env:USERPROFILE + '\.gitconfig', 'User')

This way all the tools all the time will use this .gitconfig 


I fixed the issue above, but unfortunately, I am not sure exactly how
but for future users

do two things

1. run this command to find where you .gitconfig is stored 

git config --global

This will show you where the global config file is, in my case it was on a network drive 
I am guessing because it was on a network drive sourcetree was using some cache values 
but this is a guess , i cannot confirm it

2. go to the setting button in top right corner, go to advanced, check and uncheck the use the use global user setting 

Anyway, I ended up uninstalling and re-installing git (and sourcetree) 
So what either that, or playing with the setting button cleared the cached value, wherever it was 

So again, I fixed my issue, but sadly, I am not 100% sure what fixed it 
all other tools were working fine, only sourcetree was giving me this issue
and I still have no clue where it was caching those different values it was using for the commits 

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events