Git LFS 2.3.1 seems to break Windows · Issue #2627 · git-lfs/git-lfs · GitHub
Skip to content

Git LFS 2.3.1 seems to break Windows #2627

Open

Description

@larsxschneider

Cloning a repository with LFS files via HTTPS and Git credential helper fails on Windows with the latest version:

$ git clone https://server/org/lfs.git test
Cloning into 'test'...
remote: Counting objects: 31, done.
remote: Total 31 (delta 0), reused 0 (delta 0), pack-reused 31
Unpacking objects: 100% (31/31), done.
Downloading test.bin (6 B)
Error downloading object: test.bin (54d03b8): Smudge error: Error downloading test.bin (54d03b8c1bea08ef8896747edc304ff22fbe71a9d764ef9a3ee7b1a4ea60a622): batch response: Git credentials for https://server/org/lfs.git/info/lfs not found:
exec: "C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass": file does not exist

Errors logged to C:\code\test\.git\lfs\objects\logs\20170928T122143.4412378.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: test.bin: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

git-gui--askpass is part of Windows but no "exe" file. Therefore, I don't think it can be used. Maybe @dscho or @sschuberth can give us a quick hint here as I am no Windows expert.
I think the relevant change was introduce in #2609 .

Setup

$ git --version
git version 2.14.1.windows.1

$ git lfs version
git-lfs/2.3.1 (GitHub; windows amd64; go 1.8.3; git 01fef48f)

$ git config credential.helper
wincred

Activity

  1. sschuberth commented on Sep 28, 2017

    @sschuberth
    Member

    Therefore, I don't think it can be used.

    I was about to suggest this could be worked around by ensuring to check "Associate .sh files to be run with Bash" in the Git for Windows installer, but obviously that does not work because that shell script does not have an .sh extension.

  2. technoweenie commented on Sep 28, 2017

    @technoweenie
    Contributor

    If #2609 is the relevant change, do you have SSH_ASKPASS set? I added it because Git also uses it.

    Also, have you looked at #2607? That's another change to the ASKPASS support in 2.3.1.

    I wonder if we should stat the askpass command before attempting to run it? Or just handle that error better and try the next authentication mode.

  3. dscho commented on Sep 28, 2017

    @dscho
    Contributor

    git-gui--askpass is part of Windows but no "exe" file.

    We could make it an .exe file like cmd\git-gui.exe and cmd\gitk.exe. But that still would require you to change your SSH_ASKPASS, I guess, otherwise it may try to pick up the script again...

  4. dakotahawkins commented on Oct 1, 2017

    @dakotahawkins
    Contributor

    I stuck export SSH_ASKPASS= in my .bash_profile to work around this :(

    @technoweenie According to the documentation you linked, Git should only go the "askpass" route if no credential helper is defined. In this case, a credential helper is defined.

    Before, it was probably only working for me because of the "askpass" options I only had SSH_ASKPASS defined (I have no idea who defined it, not me anyway).

    Should LFS skip trying these at all if it finds a credential helper in the config?

    @dscho Do you know off the top of your head what the analogous Git behavior actually is? Is it probable that the windows credential helper only works for https, and so GFW sets/needs/knows to use SSH_ASKPASS instead for ssh?

  5. dscho commented on Oct 2, 2017

    @dscho
    Contributor

    @dakotahawkins I think the problem is that Go does not understand scripts (apart from .bat/.cmd; git-gui--askpass is a Tcl/Tk script, though), the same way as regular Windows executables do not understand scripts. git.exe has special code to identify and execute scripts that have a #! line, as git-gui--askpass does.

  6. dakotahawkins commented on Oct 2, 2017

    @dakotahawkins
    Contributor

    @dscho Sure, that makes sense to me, but I was wondering more about Git's workflow when you have a credential helper defined. It's not clear to me from the documentation what exactly is supposed to happen. Does it try all your helpers and fall back on askpass?

    This part of the documentation that confuses me:

    Without any credential helpers defined, Git will try the following strategies to ask the user for usernames and passwords

    1. If the GIT_ASKPASS environment variable is set, the program specified by the variable is invoked. A suitable prompt is provided to the program on the command line, and the user’s input is read from its standard output.
    2. Otherwise, if the core.askPass configuration variable is set, its value is used as above.
    3. Otherwise, if the SSH_ASKPASS environment variable is set, its value is used as above.
    4. Otherwise, the user is prompted on the terminal.

    It sounds like it might be implying that it will use either credential helpers or askpass, not both, but that can't be the case, can it?

  7. technoweenie commented on Oct 2, 2017

    @technoweenie
    Contributor

    #2634 is discussing the order of credentials. I'd love more feedback on it. I should be able to roll 2.3.2 out this week based on the consensus there.

  8. dscho commented on Oct 2, 2017

    @dscho
    Contributor

    I was wondering more about Git's workflow when you have a credential helper defined.

    @dakotahawkins unfortunately, I am not an expert in that area. Maybe a good question for the git mailing list?

  9. technoweenie commented on Oct 2, 2017

    @technoweenie
    Contributor

    @dakotahawkins found it in #2634 (comment). I have a fix in #2637, which is just waiting for confirmation that it works.

  10. technoweenie commented on Oct 3, 2017

    @technoweenie
    Contributor

    This should be fixed in LFS 2.3.2.

  11. robgom commented on Apr 20, 2018

    @robgom

    Hi all,
    sorry for bothering, but the issue was resolved by reordering credentials acquiring, wasn't it? I'm not familiar with the technology.
    That'd fix the issue when credentials helper is defined.
    However, in some of our shared repositories (shared locally) we don't have credential helper enabled.
    And the results are more or less like:

    $ git -c credential.helper= clone https://repo/repo.git
    Cloning into .......
    Username for '.....': <username>
    remote: Counting objects: ..., done.
    remote: Compressing objects: 100% (...), done.
    remote: Total ... (delta ...), reused ... (delta ...)
    Receiving objects: 100% (...), ..., done.
    Resolving deltas: 100% (...), done.
    Downloading <some binary> (1.6 MB)
    Error downloading object: <the binary> (fc7e7dc): Smudge error: Error downloading <the binary> (fc7e7dc5458201c34fa64bf4b146ee1fcf0f3da72cc67d97a2c8e3d02212239a): batch response: Git credentials for https://repo.git/info/lfs not found:
    exec: "C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass": file does not exist
    
    Errors logged to C:\repos\git\.....\.git\lfs\objects\logs\20180420T215624.9198164.log
    Use `git lfs logs last` to view the log.
    error: external filter 'git-lfs filter-process' failed
    fatal: <the binary>: smudge filter lfs failed
    warning: Clone succeeded, but checkout failed.
    You can inspect what was checked out with 'git status'
    and retry the checkout with 'git checkout -f HEAD'
    
    

    Is that the same issue (git lfs 2.3.2)?

    What can I do about that?

    Regards,
    Robert

  12. ttaylorr commented on Apr 20, 2018

    @ttaylorr
    Contributor

    Hi @robgom, is this still an issue with the latest release of Git LFS? (v2.4.0).

  13. robgom commented on Apr 22, 2018

    @robgom

    Thank you for the feedback.
    I'm afraid it's still an issue, although I'm not 100% sure, because (according to some other git lifs issue, installing git lfs separately doesn't update existing embedded git version). Still, I'm 95% sure:

    MINGW64 /c/repos/git
    $ git-lfs version
    git-lfs/2.3.2 (GitHub; windows amd64; go 1.8.3; git 81153cc0)
    
    MINGW64 /c/repos/git
    $ git-lfs -c credential.helper= clone https://....git dir1
    Cloning into ...
    Username for ...
    remote: Counting objects: ..., done.
    remote: Compressing objects: 100% (.../...), done.
    remote: Total ... (delta ...), reused ... (delta ...)
    Receiving objects: 100% (.../...), ... done.
    Resolving deltas: 100% (.../...), done.
    Checking out files: 100% (.../...), done.
    Git LFS: (0 of ... files) 0 B / ... MB
    batch response: Git credentials for https://....git not found:
    exec: "C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass": file does not exist
    batch response: Git credentials for https://....git not found:
    exec: "C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass": file does not exist
    error: failed to fetch some objects from 'https://....git/info/lfs'
    
    MINGW64 /c/repos/git
    $ /c/Program\ Files/Git\ LFS/git-lfs version
    git-lfs/2.4.0 (GitHub; windows amd64; go 1.8.3; git 1a98fa5c)
    
    MINGW64 /c/repos/git
    $ /c/Program\ Files/Git\ LFS/git-lfs -c credential.helper= clone https://....git dir2
    Cloning into '...'...
    Username for ...
    remote: Counting objects: ..., done.
    remote: Compressing objects: 100% (.../...), done.
    remote: Total ... (delta ...), reused ... (delta ...)
    Receiving objects: 100% (.../...), ..., done.
    Resolving deltas: 100% (.../...), done.
    Checking out files: 100% (../...), done.
    batch response: Git credentials for https://....git not found:
    credential fill errors:
    exec: "C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass": file does not exist
    batch response: Git credentials for https://....git not found:
    credential fill errors:
    exec: "C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass": file does not exist
    error: failed to fetch some objects from 'https://....git/info/lfs'
    
    $ set | grep PASS
    SSH_ASKPASS=/mingw64/libexec/git-core/git-gui--askpass
    
    

    Is the procedure ok? Whar can I do about that?

    Regards,
    Robert

  14. ttaylorr commented on Apr 24, 2018

    @ttaylorr
    Contributor

    @robgom do you have any of the following set? $GIT_ASKPASS or $SSH_ASKPASS in your environment? core.askpass in your gitconfig?

  15. robgom commented on Apr 24, 2018

    @robgom

    Hi @ttaylorr ,

    MINGW64 /c/repos/git/
    $ git config --list | grep ask
    
    MINGW64 /c/repos/git
    $ set | grep PASS
    SSH_ASKPASS=/mingw64/libexec/git-core/git-gui--askpass
    

    HTH,
    Robert

  16. robgom commented on Apr 24, 2018

    @robgom

    BTW.
    I've tried to play with SSH_ASKPASS/GIT_ASKPASS to some extent, but to no avail.
    For example unsetting SSH_ASKPASS did not help:

    $ SSH_ASKPASS= /c/Program\ Files/Git\ LFS/git-lfs -c credential.helper= clone https://....git
    Cloning into ...
    Username for 'https://...':
    Password for 'https://...':
    remote: Counting objects: ..., done.
    remote: Compressing objects: 100% (.../...), done.
    remote: Total ... (delta ...), reused ... (delta ...)
    Receiving objects: 100% (.../...), ..., done.
    Resolving deltas: 100% (.../...), done.
    Checking out files: 100% (.../...), done.
    batch response: Git credentials for https://....git not found.
    batch response: Git credentials for https://....git not found.
    error: failed to fetch some objects from 'https://...git/info/lfs'
    

    Please let me know if I can provide any more info.

    Regards,
    Robert

  17. larsxschneider commented on Apr 24, 2018

    @larsxschneider
    MemberAuthor

    👋 @robgom ! I would like to step back for a moment and look at the problem from a different angle. What do you want to achieve here? What is your goal?

    Your command...

    $ git -c credential.helper= clone https://repo/repo.git
    

    ... works on Linux and macOS. However, it would ask you for credentials for every Git LFS file. On Windows, unfortunately, the command would not ask for credentials for every Git LFS file. It would fail in the way you showed above. That can be consider a bug. However, nobody runs into this bug as nobody wants to enter the credentials for every Git LFS file 😄. Hence my question above: What is your goal here?

  18. robgom commented on Apr 24, 2018

    @robgom

    Thank you for the heads up.
    I'm sorry if my example resulted in some confusion.

    My original requirement is that in some controlled environments git repository is shared among several developers. For that they have credential manager disabled. And so far it worked quite ok. I think we've given them custom credential helper to cache credentials for process and subprocesses only or similar.

    I'm here because for some reason the process stopped working for them. I think it'd be relevant to the changes mentioned here. I don't know what it was, still debugging the root cause.

    I'd be ok if the credentials are to be repeated for start, as then I'd be able to re-use our credential helper again. And then possibly ask for caching them between git and git-lfs for single command execution.

    Please let me know if it addresses your concern.

    Regards,
    Robert

  19. larsxschneider commented on Apr 24, 2018

    @larsxschneider
    MemberAuthor

    OK. Try this method to pass the username and password:

    git -c credential.helper='!f() { cat >/dev/null; echo username=robgom; echo password='"'"'super-secret'"'"'; }; f' clone https://repo/repo.git

    That should work on all platforms and with Git LFS. The '"'"' around the password is only necessary if you have special characters in your password.

  20. robgom commented on Apr 24, 2018

    @robgom

    Hold on ...
    I want to be asked for username and password, so putting that in my command doesn't help (it's available in history and other places).
    Unless I miss something ...

    Robert

  21. robgom commented on Apr 24, 2018

    @robgom

    Ok, let me show how it behaves with our own credential helper:

    First, git 2.14.2 with git lfs 2.3.2:

    <username>MINGW64 /c/repos/git (master)
    $ export GIT_ASKPASS=/path/git_ask_pass.sh
    
    <username>MINGW64 /c/repos/git (master)
    $ SSH_ASKPASS= git -c credential.helper= clone https://....git
    Cloning into 
    Username for ...:
    <username>
    Password for ...:
    remote: Counting objects: ..., done.
    remote: Compressing objects: 100% (.../...), done.
    remote: Total ... (delta ...), reused ... (delta ...)
    Receiving objects: 100% (.../...), ..., done.
    Resolving deltas: 100% (.../...), done.
    Downloading ...... (1.6 MB)
    Error downloading object: ...... (fc7e7dc): Smudge error: Error downloading ... (fc7e7dc...): batch response: Git credentials for https://....git/info/lfs not found:
    fork/exec C:/path/git_ask_pass.sh: %1 is not a valid Win32 application.
    
    Errors logged to C:\....\.git\lfs\objects\logs\20180424T151110.1733186.log
    Use `git lfs logs last` to view the log.
    error: external filter 'git-lfs filter-process' failed
    fatal: ...: smudge filter lfs failed
    warning: Clone succeeded, but checkout failed.
    You can inspect what was checked out with 'git status'
    and retry the checkout with 'git checkout -f HEAD'
    
    
    <username>MINGW64 /c/repos/git (master)
    $ git --version
    git version 2.14.2.windows.3
    

    And the same repeated with git lfs 2.4.0:

    <username>MINGW64 /c/repos/git (master)
    $ SSH_ASKPASS= /c/Program\ Files/Git\ LFS/git-lfs -c credential.helper= clone https://.....git
    Cloning into 
    Username for ...:
    <username>
    Password for 'https://...':
    remote: Counting objects: ..., done.
    remote: Compressing objects: 100% (.../...), done.
    remote: Total ... (delta ...), reused ... (delta ...)
    Receiving objects: 100% (.../...), ..., done.
    Resolving deltas: 100% (.../...), done.
    Checking out files: 100% (.../...), done.
    Downloading LFS objects:   0% (0/49), 0 B | 0 B/s
    
    [endless loop]
    

    (where I wanted to use my own credential helper, defined with GIT_ASKPASS, to perform arbitrary credentials caching)

    HTH,
    Robert

  22. larsxschneider commented on Apr 24, 2018

    @larsxschneider
    MemberAuthor

    What protocol did you implement with /path/git_ask_pass.sh? Why don't you define that script as credential helper?

  23. robgom commented on Apr 24, 2018

    @robgom

    Honestly, I don't fully understand the question.
    I've implemented the thing according to https://git-scm.com/docs/gitcredentials :
    "If the GIT_ASKPASS environment variable is set, the program specified by the variable is invoked. A suitable prompt is provided to the program on the command line, and the user’s input is read from its standard output."
    It should get username and password prompts, then based on its own state either provide data from some store or query user for them.
    Hence I don't understand this "what protocol" part. Could you elaborate?
    Why did I do it that way, instead of writing credential helper? I've assumed that would fit my needs. Do you think implementing credentials helper would solve my needs (cache credentials for single process tree only, then forget them)?

    Regards,
    Robert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions