I have two different bitbucket accounts set up. One is for work projects and one is for personal use. In BitBucket I have set up a repository in each of the accounts for diffe
If you've already cloned a repository with ssh on the Mac version, and you want to change the account for it, you can do this by changing the host name of the remote.
If you've let SourceTree modify your ˜/.ssh/config
, then it will have added some entries starting with:
# --- Sourcetree Generated ---
Host <account name>-<service name>
...
Choose the <account name>-<service name>
combination that you want to use and modify the path of your repository (in Remote Settings). Your new path will be something like the following format:
git@<account name>-<service name>:<account name>/<repository name>.git
(Actually, you can use this solution for working copies not cloned by SourceTree too.)
For BitBucket account/repos, you can include the username you want to use as part of the git URL. SourceTree will then ask for the password for that username.
https://username@bitbucket.org/account/repo
For SourceTree 2.0.2+ on Mac only with GitHub accounts:
All your added accounts will be listed and their respective repositories with button to clone.
Hope this helps.
on windows the tool has a bug no matter what I've tried from within the tool it was always using a previews git account which was cached somewhere... so I searched all files where sourcetree was installed and I found a file C:\Users\WIDNOWS_USER\AppData\Local\Atlassian\SourceTree\userhosts there I had cached the old git user/account name and it was driving me nuts in the app. I updated this file, deleted the old account name and added the new one, restarted the tool and it started to work fine. there's also a file C:\Users\WIDNOWS_USER\AppData\Local\Atlassian\SourceTree\passwd check that one too and if your cached account with passwd is there too clean it out, do not add here anything, the app will do it first time when you enter your password for the new acccount
In Windows you may have more than one account (you can have even GitHub and BitBucket side by side). For example, assuming the account you have now in SourceTree is with BitBucket and you want to add your GitHub account to it as well, do the following:
If I understand your question correctly, you still need to do a little bit more set of your bitBucket accounts.
You can also test the BitBucket server to see which account you are logging in with.
ssh -v git@bitbucket.org
This link help me, follow these instructions here and you should be successful.
The key part you need is in you .git/config.
You'll need separate entries for each.
Use different SSH keys for different accounts on the same Git hosting