Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitLFS does not ask for credentials on Windows #2349

Open
larsxschneider opened this issue Jun 22, 2017 · 13 comments
Open

GitLFS does not ask for credentials on Windows #2349

larsxschneider opened this issue Jun 22, 2017 · 13 comments
Projects

Comments

@larsxschneider
Copy link
Member

larsxschneider commented Jun 22, 2017

If you clone a private repository and there is no Git credential helper installed then Git should ask for the credentials once and Git LFS should ask for the credentials at least once.

It should look like this:

git -c credential.helper= clone https://server/private/repo
Cloning into 'lfs-cred-test'...
Username for 'https://server': larsxschneider
Password for 'https://larsxschneider@server':
remote: Counting objects: 52, done.
remote: Compressing objects: 100% (27/27), done.
remote: Total 52 (delta 16), reused 52 (delta 16), pack-reused 0
Unpacking objects: 100% (52/52), done.
Downloading folder/demo.file (3.00 MB)
Username for 'https://server': larsxschneider
Password for 'https://larsxschneider@server':

That works nicely on macOS but not on Windows 7/8/10 with Git LFS 2.1.1 (in cmd.exe and git-bash). On Windows GitLFS does not ask for the credentials and consequently the LFS file download fails.

c.f. git-for-windows/git#1192

@ttaylorr
Copy link
Contributor

@larsxschneider thanks for opening this up. This is on my list of things to look at, and I have a few preliminary ideas of what might be going on. I'm finishing up the 2.2.0 release and will have more time to look at this after that.

@Toby-D
Copy link

Toby-D commented Jul 17, 2017

Same issue here.

In my case, I'm running lfs 2.2.0 on Windows 10 (Build 15063).
I'm using Git Bash as my terminal. (GitHub Desktop also fails.)

When I try to checkout a branch of a private GitHub repository, I get the error message below, telling me that credentials were not found.

After encountering the error, I installed Git-Credential-Manager-for-Windows. That didn't fix anything.

Any suggestions would be helpful (including obvious or fundamental ones, since I'm still trying to get my head around git and lfs).

Error message:

Downloading CAD/piston.stl (5.56 MB)
Error downloading object: CAD/piston.stl (0b4f40b): Smudge error: Error downloading CAD/piston.stl (0b4f40b3f6aca82f3f0b67733a88125050d32034ceea5644b5a78236169214b7): batch response: Git credentials for https://github.com/peteb...fd.git/info/lfs not found.

Errors logged to C:\Users\<user>\Desktop\...fd\.git\lfs\objects\logs\20170717T103507.4636645.log
Use `git lfs logs last` to view the log.
error: external filter git-lfs smudge -- %f failed 2
error: external filter git-lfs smudge -- %f failed
fatal: CAD/piston.stl: smudge filter lfs failed

@ttaylorr ttaylorr added this to the v2.4.0 milestone Jul 24, 2017
@ttaylorr
Copy link
Contributor

ttaylorr commented Aug 8, 2017

@Toby-D thanks -- I spent some time looking into this today and my current line of thinking is that this is a bug in the way that Git for Windows invokes Git LFS. I've replied here with more.

Even though that issue pertains to absent credential helpers, I think that the underlying bug would affect this case, as well.

@viric
Copy link

viric commented Mar 23, 2018

git-lfs calls "git credential fill" without a terminal connection (it's how it uses golang os/exec in). If you do not set GIT_ASKPASS, git will try to use the terminal, and that will fail.

In git-for-windows you can use the git credential.hepler "manager" (=Windows Credential Manager interface), that uses a window popup to ask user/pass details.

On cygwin git I use GIT_ASKPASS calling the msys libexec git-gui--askpass written in TK, that pops up a dialog when I use the git credential.helper "cache".

@amosialek
Copy link

amosialek commented Jun 12, 2018

This bug is almost 1 yo and seems to be still in code (I have the same issue as OP)

git credential.hepler "manager"

didn't help in my case (no popup has popped up)

EDIT: I managed to fix it by entering creds in Control Panel > User Accounts>Credential Manager > Windows Credentials.
I had empty credentials there in git:https://git_repo_url
I entered my creds there and it works

EDIT2: Looks like I had old version of git installed (2.15). Installing git 2.17.1 seems to fix this issue

@ttaylorr
Copy link
Contributor

@dscho is this fixed in 2.17.1?

@dscho
Copy link
Contributor

dscho commented Jun 16, 2018

@ttaylorr I don't know ;-) I have no recollection of fixing much prompt-related, apart from git-for-windows/git@b339cda (which might have fixed this here issue?) I do not recall any changes in the way sub-processes are spawned, except that we now try to restrict inherited file handles. Not sure whether this would have the effect of fixing this here issue.

@geki-yaba
Copy link
Contributor

I have my own askpass set in GIT_ASKPASS and git-lfs does not translate path with 'cygwin -w' and therefore fails. Same for the cert file: (useless info obfuscated :-)

08:51:48.565147 trace git-lfs: creds: filling with GIT_ASKPASS: /home/<user>/w64-ssh-askpass.exe Userna
me for "https://<git server>"
08:51:48.565147 trace git-lfs: exec: /home/<user>/w64-ssh-askpass.exe 'Username for "https://<git server>"'
08:51:48.573127 trace git-lfs: credential fill error: exec: "": executable file not found in %PATH%
08:51:48.573127 trace git-lfs: creds: git credential fill ("https", "<git server>", "")
08:51:48.574167 trace git-lfs: exec: git 'credential' 'fill'
08:51:48.689883 trace.c:487             performance: 0.087103900 s: git command: git credential fill
08:51:48.757964 trace git-lfs: Filled credentials for https://<git server>/<git repo>
08:51:48.757964 trace git-lfs: Error reading cert file "/etc/pki/tls/certs/ca-bundle.crt": open /etc/pki/tls/certs/ca-bundle.crt: The system cannot find the path specified.

@dscho
Copy link
Contributor

dscho commented Apr 9, 2021

GIT_ASKPASS does not pass any Unix-style path. Are you sure that the .crt path comes from Git, and is not read from somewhere by your custom helper (whose duty it would be to make sure to convert it to a Windows path if it is not already one)?

@geki-yaba
Copy link
Contributor

geki-yaba commented Apr 9, 2021

Well, I am with cygwin. :-) I will open another bug for cygwin translation patch.

@dscho
Copy link
Contributor

dscho commented Apr 9, 2021

Oh, sorry, I naturally translate "on Windows" to "Git for Windows"...

@TheButlah
Copy link

I'm here with git version 2.31.1.windows.1 and the problem still seems to be there...

@bk2204
Copy link
Member

bk2204 commented May 4, 2022

Do you have GIT_ASKPASS set properly? The Git for Windows version may also require DISPLAY. If not, are you seeing a prompt at the terminal?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

10 participants