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

credential-cache unavailable; no unix socket support (Git for Windows) #723

Closed
1 task done
miya789 opened this issue Jun 3, 2022 · 10 comments · Fixed by #729
Closed
1 task done

credential-cache unavailable; no unix socket support (Git for Windows) #723

miya789 opened this issue Jun 3, 2022 · 10 comments · Fixed by #729
Labels
experimental Specific to an experimental feature

Comments

@miya789
Copy link
Contributor

miya789 commented Jun 3, 2022

Which version of GCM are you using?

Git Credential Manager version 2.0.696+4365b917da

Which Git host provider are you trying to connect to?

  • GitHub
  • (probably others as well)

Can you access the remote repository directly in the browser using the remote URL?

This is a problem that always occurs with private repositories, so I will omit it.


Expected behavior

To pass through two factor authenticattion, GCM shows UI for browser login with built-in cache enabled.

As noted in Git's built-in credential cache like below:

Git's built-in credential cache

Available on: Windows, macOS, Linux

Actual behavior

Terminal shows like below,

fatal: credential-cache unavailable; no unix socket support

Moreover, GCM UI does not appear.

Logs

> git config -l
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master

> git --version
git version 2.36.1.windows.1

> set GCM_TRACE=1
> set GIT_TRACE=1
> set GCM_CREDENTIAL_STORE=cache

> git clone https://github.com/example/private-repo.git
22:22:01.475107 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
22:22:01.475107 git.c:459               trace: built-in: git clone https://github.com/example/private-repo.git
Cloning into 'private-repo'...
22:22:01.487107 run-command.c:654       trace: run_command: git remote-https origin https://github.com/example/private-repo.git
22:22:01.495106 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
22:22:01.499106 git.c:748               trace: exec: git-remote-https origin https://github.com/example/private-repo.git
22:22:01.499106 run-command.c:654       trace: run_command: git-remote-https origin https://github.com/example/private-repo.git
22:22:01.506615 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
22:22:01.783809 run-command.c:654       trace: run_command: 'git credential-manager-core get'
22:22:01.827999 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
22:22:01.827999 git.c:748               trace: exec: git-credential-manager-core get
22:22:01.827999 run-command.c:654       trace: run_command: git-credential-manager-core get
22:22:01.908583 ...\Application.cs:95   trace: [RunInternalAsync] Version: 2.0.696.25923
22:22:01.908583 ...\Application.cs:96   trace: [RunInternalAsync] Runtime: .NET Framework 4.0.30319.42000
22:22:01.908583 ...\Application.cs:97   trace: [RunInternalAsync] Platform: Windows (x86-64
22:22:01.912606 ...\Application.cs:98   trace: [RunInternalAsync] OSVersion: 10.0 (build 22000
22:22:01.912606 ...\Application.cs:99   trace: [RunInternalAsync] AppPath: C:\Program Files\Git\mingw64\bin\git-credential-manager-core.exe
22:22:01.912606 ...\Application.cs:100  trace: [RunInternalAsync] Arguments: get
22:22:01.952593 ...GitCommandBase.cs:33 trace: [ExecuteAsync] Start 'get' command...
22:22:01.960594 ...GitCommandBase.cs:47 trace: [ExecuteAsync] Detecting host provider for input
22:22:01.960594 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   protocol=https
22:22:01.960594 ...GitCommandBase.cs:48 trace: [ExecuteAsync]   host=github.com
22:22:01.996605 ...viderRegistry.cs:149 trace: [GetProviderAsync] Performing auto-detection of host provider
22:22:02.012965 ...viderRegistry.cs:158 trace: [GetProviderAsync] Auto-detect probe timeout is 2 ms
22:22:02.012965 ...viderRegistry.cs:166 trace: [GetProviderAsync] Checking against 4 host providers registered with priority 'Normal'.
22:22:02.012965 ...GitCommandBase.cs:50 trace: [ExecuteAsync] Host provider 'GitHub' was selected
22:22:02.016967 ...\HostProvider.cs:126 trace: [GetCredentialAsync] Looking for existing credential in store with service=https://github.com account=...
22:22:02.056999 exec-cmd.c:237          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
22:22:02.056999 git.c:459               trace: built-in: git credential-cache get
fatal: credential-cache unavailable; no unix socket support
...

Windows Version: 21H2 (OS Build 22000.675)

Git's built-in credential cache says cache can be used in Windows.
But in this stackoverflow question, Windows does not support unix socket.
Could you please let me know if you plan to support cache in Windows with GCM?

release note about GCM says,

GCM can now also use Git’s git-credential-cache helper that is commonly built and available in many Git distributions. This is a great option for cloud shells or ephemeral environments when you don’t want to persist credentials permanently to disk but still want to avoid a prompt for every git fetch or git push.

So I'm looking forward to being able to use cash at GCM not to leave credential in Windows.

@miya789 miya789 added the experimental Specific to an experimental feature label Jun 3, 2022
@dscho
Copy link
Collaborator

dscho commented Jun 3, 2022

Hmm. This is a report about the git-credential-cache command, but this issue tracker is about the git-credential-manager-core command...

@miya789
Copy link
Contributor Author

miya789 commented Jun 4, 2022

Certainly true.
But the document about git-credential-manager-core says that built-in credential cache ( git-credential-cache ) can be used on Windows.
So if you are going to give up using "built-in credential cache on Windows", wouldn't it be better to rewrite the documentation (https://github.com/GitCredentialManager/git-credential-manager/blob/main/docs/credstores.md#gits-built-in-credential-cache)?

(However, I wish git-credential-manager-core would support "cache".... Sorry for not contributing because I cannot understand unix socket...)

@dscho
Copy link
Collaborator

dscho commented Jun 5, 2022

@miya789 looks as if this documentation change has been introduced in 08124c9#diff-4663e076ac4040ad436db8af5dfb42e609b381625e149a81737e83d18c206cb6R151. Well spotted!

Would you mind opening a PR to remove "Windows" from that line?

Full disclosure: Technically, since Git v2.34.0, git-credential-cache.exe can be built and run on Windows. Unix Sockets support has been introduce into Windows. The problem is that you need Windows 10 build 17061 or later, and Git for Windows still supports even Vista (although it has been announced that Git for Windows will drop supporting Vista really soon now).

@miya789
Copy link
Contributor Author

miya789 commented Jun 5, 2022

@dscho
(Sorry for not writing the relevant commitments.)

Would you mind opening a PR to remove "Windows" from that line?

Thank you. I will do it later.

However, I just regret that I can't do it on Windows.
I'm using Windows 11 build 22000.675 and git version is "git version 2.36.1.windows.1".
But it didn't seem to support UNIX sockets.
image
Do you happen to know anything about it?
(do you mean to build git-credential-cache.exe myself?)

@dscho
Copy link
Collaborator

dscho commented Jun 6, 2022

Yes, you will have to build Git (making sure to override NO_UNIX_SOCKETS).

@miya789
Copy link
Contributor Author

miya789 commented Jun 6, 2022

Then, the following understanding is correct?

  • The source code of "Git for Windows" contains code to support "UNIX sockets", but it still officially supports Vista, hence "NO_UNIX_SOCKETS" is enabled.
  • Thus, the officially distributed executable file cannot support "UNIX sockets".
    However, if we disable "NO_UNIX_SOCKETS" and build the executable file from source code by ourselves, it can support "UNIX sockets".
  • In the beginning of 2023, when Vista support ends, the officially distributed "Git for Windows" will also be able to support "UNIX socket".

If no problem, when fixing doc, I will mention about this in PR.

@dscho
Copy link
Collaborator

dscho commented Jun 6, 2022

  • The source code of "Git for Windows" contains code to support "UNIX sockets", but it still officially supports Vista, hence "NO_UNIX_SOCKETS" is enabled.

Almost. It's the source code of Git, not just Git for Windows. And as I mentioned above, Unix sockets support was introduced with Windows 10 build 17061. Therefore, if you replace "Git for Windows" with "Git", and "Vista" with "Windows 10 before build 17061" in your statement, then it is 100% correct.

  • In the beginning of 2023, when Vista support ends, the officially distributed "Git for Windows" will also be able to support "UNIX socket".

I plan on dropping support in Git for Windows for Windows Vista way before 2023. And when that happens, we will still support many Windows versions before Windows 10 build 17061. Therefore, we cannot simply enable support for Unix sockets in Git for Windows.

We might get something in the way of "if you start git.exe credential-cache on a Windows version that supports Unix sockets, it will work, otherwise it will error out and tell you why". It'll depend on what contributors offer in the way of PRs.

@hickford
Copy link
Contributor

https://stackoverflow.com/questions/67951554/error-fatal-credential-cache-unavailable-no-unix-socket-support

credential-cache unavailable; no Unix socket support

Is there an upstream bug for this issue? I couldn't find anything at https://github.com/git-for-windows/git/issues

@miya789
Copy link
Contributor Author

miya789 commented Jun 13, 2022

I could not find it either.
However, since it seems to be the current policy not to support with Git for Windows, I didn't especially care about it.

  • In the beginning of 2023, when Vista support ends, the officially distributed "Git for Windows" will also be able to support "UNIX socket".

I plan on dropping support in Git for Windows for Windows Vista way before 2023. And when that happens, we will still support many Windows versions before Windows 10 build 17061. Therefore, we cannot simply enable support for Unix sockets in Git for Windows.

@hickford
Copy link
Contributor

Is there an upstream bug for this issue? I couldn't find anything at https://github.com/git-for-windows/git/issues

Opened git-for-windows/git#3892

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

Successfully merging a pull request may close this issue.

3 participants