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
Input your username and password and press enter. That’s it.
Source (somewhere in between the lines):