How do I get commits from sourcetree to connect to my github account?
Asked by Katherine Wyman:

Hello,

When I set up SourceTree, I did so with a recently created BitBucket account. Everything is working fine, except I would like my commits and pushes to github to be associated with my github account. Currently they're associated with my bitbucket account.

In the sourcetree repository browser, I've tried adding and setting to default my github account, and I think everything worked, however recent commits since this account change are still associated with my bitbucket account. What should I try next?

Most of the questions I've see on this topic so far don't seem to match my issue, and I haven't found any resolution through the ones I've tried. Any help greatly appreciated!


Answers:
author: minnsey
body: Hi  

Can you provide more context?  

If I've understood correctly you have an existing local repository where the remote is configured to use Bitbucket, but you would like to change this to be GitHub?  

If that is correct you would need to add GitHub remotes in the Repository Settings, the cog in the upper right of the repository tab and then select the GitHub remote when pushing.  

Is this what you are trying to do?

comments: author: Katherine Wyman
body: Hi Michael, thanks for the response.

I think that's correct.

Currently my local repo is connected through Sourcetree to the correct GitHub remote repo. However the account associated with my commits to the GitHub repo is not my GitHub account. I think it's the account I set up with Bitbucket when I was setting up Sourcetree. Is there any way to change the account associated with commits and pushes through Sourcetree?

Thanks very much


author: minnsey
body: OK, is it possible you are referring to the commit author and email address? If so you can edit them in the Tools/Options/General tab.  

Alternatively if you want to add other accounts to remote services you can use the Tools/Options/Authentication tab and then associate the account to your repo in the Repository Settings.


author: Katherine Wyman
body: So I don't have a Tools/Options/General menu option (in Sourcetree if that's what you meant), but I can see where I would change my Full Name and Email address in the General tab of Settings, but will this link my commits to my GitHub account? I've tried changing these and see no difference in the commit author on GitHub.

Here's some screen caps that will hopefully explain better than I can, here's what's currently happening:

![githubName.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/47334i716BD46747CD17AA/image-size/large?v=v2&px=999 "githubName.jpeg")

And here's what I want to happen:

![githubAccount.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/47335i4D06A78AD68074F2/image-size/large?v=v2&px=999 "githubAccount.jpeg")

I've tried adding my GitHub account through the Accounts tab in Preferences for Sourcetree, but when I try to connect to the username Katy6514 via SSH, I save it and an error pops up saying something about how there was a problem adding the SSH key to my account and I need to manually add the key. I can't get the full error because it doesn't all fit on the popup and as soon as I click on it, it slides off screen and doesn't open a page in the browser like I expect.

When I click on "Connect Account" in the settings panel for adding a new account, chrome fails to open this link: ([https://github.com/login/oauth/authorize?client_id=6c1278ba8f154ef74ff0\&redirect_uri=sourcetree%3A%2F%2Foauth\&response_type=code](https://github.com/login/oauth/authorize?client_id=6c1278ba8f154ef74ff0&redirect_uri=sourcetree%3A%2F%2Foauth&response_type=code)) it just hangs. When I copy/paste that link into Safari, I'm asked by Safari if I want to open Sourcetree (which is already open). When I click "ok", it just takes me back to that same settings tab for connecting an account, with no noticeable change. When I click "save" anyways, the same error pops up in the right hand corner of my screen saying there was an error adding my SSH key to my GitHub account.

I've tried to add the SSH key supplied from Sourcetree to my GitHub account manually (as suggested by the error popup), and when I try to save the SSH key in GitHub, I'm told it's already in use. Not really sure what to try now.

Thanks very much for your assistance on this, I'm not really sure if this is a problem on GitHub's side or with how I've set up SourceTree, but I really would like all this work I'm doing to be associated with my GitHub account!


author: minnsey
body: Ah you are on mac?  

It does sound like you need to change the GitHub account you are using. I'll ask on of the mac Devs to get back to you.


author: Katherine Wyman
body: Yes, on a mac, sorry I forgot to specify! I appreciate it.


Tags: github

mac