It seems SourceTree can be pretty annoying in this respect. In my case, the problem was I had introduced a wrong password the first time I used SourceTree. I solved this (on a Mac) by going to SourceTree > Preferences > Accounts, clicked on my account, set the correct password and voilà. Done.