When Sourcetree keeps asking for password when committing or pushing data to a server, the following solution worked for me:
Go to terminal in your project folder and enter:
git config credential.helper store
git pull
Input your username and password and press enter. That’s it.
Source (somewhere in between the lines):
https://community.atlassian.com/t5/Sourcetree-questions/Sourcetree-keeps-asking-for-login-and-password/qaq-p/146765#M18512