How to get LFS to use saved project credentials?
Asked by Ally:

Hi there, I recently updated our repro to use LFS. Our team has pulled latest then been promoted in Source Tree to install the relevant LFS extensions. Then when relaunching source tree they are prompted to run "git lfs pull" as "it does not appear the binary content has been downloaded yet". When clicking Yes to download, after a few seconds, some of our team members are getting the following error:

*git -c diff.mnemonicprefix=false -c core.quotepath=false lfs pull*

<br />

*Git credentials for https://MyName@MyProject.git not found.*   
*Git credentials for https://MyName@MyProject.git not found.*

*Git LFS: (0 of 63 files) 0 B / 1.08 GB*

<br />

*Completed with errors, see above.*

Running git 2.81 with git lfs 1.2.0 in Source Tree 1.9.6.0

Everyone has saved credentials in sourcetree and can log into their bitbucket accounts without issue. I have no idea how to fix this and much Googling has not helped us much either. We're game devs and this is our first git project.

Any help would be great.

[](https://community.atlassian.com/t5/Sourcetree-questions/How-to-get-LFS-to-use-saved-project-credentials/qaq-p/220166?attachment-id=3996){#link_1168efe62bb1b7}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/6479/1/password_dialog.png){#display_1168efe62bb1b7_0}


Answers:
author: Rodney
body: Hello,

It seems SourceTree's git-lfs UI doesn't use the authentication information in options.

Open a Terminal for the repo and do "git lfs pull". This should bring up a dialog box asking for a password. (Mine did this twice).

password_dialog.png

Enter your password, if you are using two-factor authentication make sure to use your "App password".

It should start downloading the files and would work from the command line or the GUI. If your password doesn't seem to be getting saved you'll need to enable caching by executing 'git config --global credential.helper wincred' from the terminal. This stores your password in "Credential Manager" that command line git can use.

Do a search for "Credential Manager" in the Start Menu if you want to remove it.

comments: author: Max Pixel
body: Even though I do have xxx@ in my remote URL, this does not work for me. The only solution was to `git pull` from mingw instead of through the UI (which required entering the password for every single lfs download).


author: guinzoo
body: I found some workaround, just go to Options -\> Git, and hit Use Embedded Git.


author: Alex Goldberg
body: I hit this issue as well. After some trial-and-error, I realized this was due to the fact that I had multiple Bitbucket accounts configured in SourceTree. Even though "Account A" was my default, the error message was showing "Account B" as the username.

This was resolved when I removed "Account B" from SourceTree (File -\> Clone/New... -\> \<Globe button\> -\> Edit Accounts...).

Oddly, **both** accounts had read/write access to my repository.


author: Ally
body: Hi, thanks for the reply. Sadly the lfs pull command would not prompt for password. We also tried caching the credentials first as well which also did not work. Again, normal pull worked fine. This seems like a bug that it works for normal pull but not lfs, no?

ST_001.png

We're a bit reluctant to go down the road of having a credtail manner, it seems like ti would complicate an otherwise fairly simple setup. Trying to look for more workarounds now.  
[](https://community.atlassian.com/t5/Sourcetree-questions/How-to-get-LFS-to-use-saved-project-credentials/qaq-p/220166?attachment-id=6217){#link_1168efffe52a82}  
[](/tnckb94959/attachments/tnckb94959/sourcetree-questions/6481/1/ST_001.png){#display_1168efffe52a82_0}

comments: author: Rodney
body: I added a screenshot to my answer below that shows the password dialog box.

I was able to reproduce your problem of the dialog box not showing. It involved cloning the repo but without providing a username like:

[https://bitbucket.org/company/repos.git](https://bagukiri@bitbucket.org/skunkops/gyrocopter.git)

[](https://bagukiri@bitbucket.org/skunkops/gyrocopter.git)So I suggest you re-clone using

[https://username@bitbucket.org/company/repos.git](https://bagukiri@bitbucket.org/skunkops/gyrocopter.git)

Editing the config file's lfs entry won't work because somehow SourceTree thinks it has to add it for you and you'll see multiple entries.

Unfortunately you'll still see your original problem but if you follow my answer it would get fixed.