Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do you force SourceTree to use the correct username?

This seems related: https://answers.atlassian.com/questions/148713/sourcetree-commit-author-change-update

I'm using SourceTree with a few of my projects, and so far I've really enjoyed it. However, one issue that seems to keep coming back up is that SourceTree seems to have its own rules when it comes to what username to pick as the author when creating commits. Specifically, in a Mercurial repostiroy, it should be using the repo-local `.hg/hgrc` to determine username. If not set there, then it should be using global settings as defined in `~/.hgrc` (in POSIX systems). Both these rules can be overridden directly in SourceTree (although why anyone would want to do that is beyond me).

It doesn't seem to be following these rules. I have a repository in which there is no username set, and I have SourceTree configured to use global settings, but the wrong username is still chosen. See here:

Redacted contents of my `~/.hgrc`:

Also, I do not allow SourceTree to modify any settings:

SourceTree *seems* to - absent any other guidance - want to use "Full Name <email@mydomain.com>" as the author rather than what's configured in my global `~/.hgrc`, and I don't get where that's coming from at all.

8 answers

Version 1.9.1 force the user to have non-empty email field in the commit dialog(because now it is separate inputfield). That's really annoying because now it is impossible to follow the rule, when commit message should store username only, like in openjdk project. Is it possible to relax this requirement?

I did finally figure it out. Sourcetree has an embedded mercurial that has it's *own hgrc* where extensions and certain ui elements are configured. However, the name and email I used to activate Sourcetree are also there. Sourcetree also fails to patch my system mercurial, so I am forced to edit the embedded hgrc. I consider this to be a major fail:

As an asides, it looks like you're using a very old version there as you've got the old icon set. We don't publish to the Mac App Store any more. You can get it direct at sourcetreeapp.com. If the problem exists in the latest version I can take a look into this issue.

Cheers

It looks like I had an old version as you say. I updated, and it seems that the more recent version (1.7.3) does not set the username in the embedded hgrc. It still won't patch my system hg, but I can get along without that now.

Ok, I thought it was all right now, but I just noticed:

This is still not the correct behavior. The author field should be exactly what I have set in .hgrc and not try to be smart.

Hi Ben,

The part of your config that you've blurred out in your first post seems too short to include your e-mail address. It should be in the format of:

username = Kieran Senior <fake_email@email.com>

See this web page: http://hgtip.com/tips/beginner/2009-09-30-configuring-mercurial/

If your config does indeed only include the username portion then SourceTree is behaving correctly because it's taking the config files in their rightful order. You've turned on the option for SourceTree to use the global config settings. To me it looks like the global setting doesn't have an e-mail specified.

Cheers.

I don't see any reason why username has to include an email address, despite the fact that the examples all use that format. I can see from the commit history that Sourcetree actually does respect my settings when it writes the commit (presumably because Sourcetree doesn't actually write the commit), but the value used to populate the Author text input is misleading and should match the value resolved from the configs.

I completely agree with this, there is no reason why the email should be enforced despite the global settings. I have actually had to stop using Source tree because of this. Each time I commit I have to setup a fake email and the use an alternative user and when I do this I need to remember the correct way to avoid it changing my global settings and local settings. This is easy to forget and I have made many commits using the wrong username because of this. It becomes quite frustrating to micro manage. Great program otherwise but unfortunately I cannot use it anymore.

I'm afraid I don't fully understand this:  SourceTree is using a personal email address to do check ins even though I have checked the "Use global User Settings" and provided details.

I don't fully udnerstand where is it getting my other email from - where is this (I am using a GIT repo and a Mecurial repo and it does it in both.

 

UPDATE: I found the problem:  it was stored incorrectly in the .girconfig file in my Windows User Profiel

You can fix it by

Globally:

$ git config --global user.name "John Doe" $ git config --global user.email "john@doe.org"

 

Or  per repo:

$ git config user.name "John Doe" $ git config user.email "john@doe.org"

 

Source 

 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

3,712 views 19 19
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you