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

How to change username?

nfrydenholm April 22, 2012

How can I change/specify the username used for my commits? I am committing to BitBucket, and using SourceTree my commit-name is now fullname_emailAddress (or a format close to that).

I have used MacHG so far, where I have added the following to the hgrc file for MacHg

[UI]

username = myShortBitBucketUserName

But if I add those lines to my repo-config i SourceTree the line with the username is just deleted again.

I have tried to change my user-info as specified here

But whenever I change my name, the change is reverted when I re-open the settings?

4 answers

1 accepted

5 votes
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2012

Your commits are actually nothing to do with your Bitbucket account (although you might use the same email address). Commits in a DVCS are entirely local, so you specify two things to identify the commits as yours:

  1. Your full name
  2. Your email address

Later when you push these commit to somewhere else, you may need authentication to do so (e.g. your Bitbucket user name), but this is completely separate from the commit user details. For example, you may actually push a commit someone else has created, meaning the commit user is different from the user you use to push.

Anyway, to change the details used to commit in SourceTree can be done in two places:

  1. Preferences > General: fill in the Full name and Email address fields. These details will apply to all repositories unless you change it
  2. In the repository window, click Settings in the top-right, then Advanced. Here you can change the same details just for this single repository, allowing you to, for example, use a work email address to commit to one repository and a personal email address for another.
nfrydenholm April 23, 2012

Thanks for your reply.

What I am trying to achieve is to commit using my BitBucket alias name instead of using "fullname_<email_address>".

I have a python script running for "commit-blame" - it will fire a USB rocket launcher towards the developer who broke the (Jenkins) build. That python script contains all developers BitBucket aliases, but committing/pushing using SourceTree, the alias is now no longer used.

But from your reply it doesn't look like using the alias is possible? I tried to add my alias in the Full Name input, but the email address is still being appended.

Like nevermfelixr likes this
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2012

It's just not how you're supposed to commit to a DVCS, the commits are supposed to be unique irrespective of hosting service, that's why there's a full name and email address. Perhaps you should just use a mapping table in your python script to translate emails to Bitbucket user names if you want to integrate that way, or maybe you should just program your rocket launcher to identify people by email?

ryuuguu March 14, 2015

On Windows version 1.6 SourceTree there is no Preferences > General - instead look under Tools > Options > General

Ahmad Atef April 19, 2018

Thanks,
working like a charm 👌
You also have to restart SourceTree app.

Like Kumar Raju likes this
1 vote
Amit Mittal July 11, 2017

For MAC::

1) Click on top-right corner Settings icon

2) Click on Remotes tab

3) Select the repository for which you want to change the user name

4) Click on Edit button

5) Change the user name in Username text field

 

If after makign above changes, you still see the old user name while pull/commit operations, than change the repository url from http://<olduser>@git.<Server>.com:.. to http://<newuser>@git.<server>.com....

 

It works for me, and i hope it works for you too :-) 

 

Thanks

Amit Mittal

0 votes
robinrjoe May 18, 2021

There are couple of solutions that can be helpful in changing username.

Solution 1

Tools --> Options --> Authentication --> Add

Add your username and password and set it as default

Solution 2

Add your user in clone URL, which will make source tree to prompt username and password with the mentioned password.

https://{username}@bitbucket.org/...

Solution 3

Source tree saves username in the below file. Change your username in this file and restart your sourcetree App

C:\Users\{USER}\AppData\Local\Atlassian\SourceTree\userhosts 

0 votes
gokul sai June 29, 2016

In source tree menu tools>options>general>default user information  here you can edit your username & mailid.

thanks,

Gokul

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events