'Unknown' User in Sourcetree

I am currently testing out stash and I came across an issue where I download Sourcetree and set my credentials (Name and email) for the use of having a Author on commits. Every time I commit, it shows my author as 'unknown<mycomputername>'. I looked up this issue and it seems like one other person came across this, but was able to solve it by reentering their data under Tools-> Options. The only way I can fix this issue is by going to Repository -> Repository Settings -> Advanced and unclicking 'Use global user settings'. Can anyone explain to me the source for this issue? Is there a way to prevent this from occurring?

3 answers

1 accepted

I'm no Sourcetree guru, but it seems like you did everything right initially.

You should be able to set your username and email globally for git through the command line though.

git config --global user.name "Jennifer Connor"
git config --global user.email "your@email.com"

At least this way you'll be spared from needing to do this for each repo.

Aseem, I appreciate this response. I decided to try using git command line and it has worked quite well. It has also solved the issue with SourceTree so I will recommend users go with this approach during their setup.

Jen, I'm glad it worked out so well for you. Always happy to help.

Worked like a charm. Thanks a ton.

just fixed my problem at work today, thanks :)

Another option is to edit the file:

C:\Users\<Username>\AppData\Local\Atlassian\SourceTree\git_local\etc\gitconfig

a hidden folder by default...

Add the lines:

 

[user]

    name = &lt;My Name&gt;

I have the same problem, but the accepted solution does not work for me. Neither does the workaround of the original poster.

Problem: When pushing unknown<mycomputername> is used.

  

remote: refs/heads/Feature-QCP-1055-plq-40k-80k-refactored:
96374b247370a007554fb59efbf4b85526c27bb0: expected committer email
'firstname.lastname@capgemini.com' but found
'shortname@computername'[K

remote:
refs/heads/Feature-QCP-1055-plq-40k-80k-refactored:
96374b247370a007554fb59efbf4b85526c27bb0: expected committer name 'firstname
lastname' but found 'unknown'[K

 

The author name and e-mail is configured in Tools -> Options -> General.

In Repository -> Repository Settings -> Advanced it does not matter if 'Use global user settings' is checked or not.

Using Sourcetree version 1.6.5.0 with embedded GIT 1.8.3.

 

I had a similar error after updating Sourcetree, and updating the git.config (global, local and system) to the correct user name and email didn't help. It turned out that the commit that I wanted to push had been made with the wrong name and email, so the remote wouldn't accept it. Running git commit --amend --reset-author fixed the problem once the correct information was in the config file (or in the Sourcetree options, which are equivalent).

Thank you very much. I was struggling with this for hours and this was the answer.

So, setting user and email in the Advanced window on Repository Settings and after that deleting local master branch and checking it out again was solution.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

261 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot