microsoft / VFSForGit

Virtual File System for Git: Enable Git at Enterprise Scale
MIT License
5.99k stars 453 forks source link

Mac: authentication failed due to "credential-osxkeychain is not a git command" #1192

Open langxuan opened 5 years ago

langxuan commented 5 years ago

We've extended gitlab with gvfs protocol and encountered this error during "gvfs clone".

With debug mode of git-credential-manager on, the detailed log is as follows:

Clone parameters: Repo URL: http://gitlab.example.com/hal/demo.git Branch: Default Cache Server: Default Local Cache: /Users/Hal/.gvfsCache Destination: /Users/Hal/gvfs/demo.git Authenticating...— Authenticating...\ Authenticating...\ Authenticating...| Authenticating...| Authenticating.../ Authenticating.../ Authenticating...— Authenticating...Failed. Run 'gvfs log /Users/Hal/gvfs/demo.git' for more info. Cannot clone because authentication failed: git: 'credential-osxkeychain' is not a git command. See 'git --help'. Configuration::loadGitConfiguration Configuration::ParseGitConfig credential.helper = !/Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home/bin/java -Ddebug=true -Djava.net.useSystemProxies=true -jar /usr/local/Cellar/git-credential-manager/2.0.4/libexec/git-credential-manager-2.0.4.jar diff.tool = Kaleidoscope difftool.Kaleidoscope.cmd = ksdiff --partial-changeset --relative-path \"$MERGED\" -- \"$LOCAL\" \"$REMOTE\" difftool.prompt = false merge.tool = Kaleidoscope mergetool.Kaleidoscope.cmd = ksdiff --merge --output \"$MERGED\" --base \"$BASE\" -- \"$LOCAL\" --snapshot \"$REMOTE\" --snapshot mergetool.Kaleidoscope.trustexitcode = true mergetool.keepBackup = false mergetool.prompt = false user.email = xxxx@xxx.com user.name = Hal Program::loadOperationArguments Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Program::EnableTraceLogging Program::get targetUri = http://gitlab.example.com/ Program::ComponentFactory::createSecureStore Getting a persistent token store that must be secure Getting a persistent credential store that must be secure Program::createAuthentication detecting authority type BaseVsoAuthentication::getAuthentication BaseVsoAuthentication::detectAuthority failed detection authority is basic BasicAuthentication::getCredentials SecretStore::getTargetName Secret::uriToName target name = gcm4ml:git:http://gitlab.example.com SecretStore::readCredentials SecretCache::readCredentials SecretCache::_getTargetName Secret::uriToName target name = gcm4ml:git:http://gitlab.example.com BaseSecureStore::readCredentials fatal: could not read Username for 'http://gitlab.example.com/': terminal prompts disabled

langxuan commented 5 years ago

By modifying environment variable controlling prompting, "gvfs clone" succeeded. processInfo.EnvironmentVariables["GIT_TERMINAL_PROMPT"] = "0"; What's the reason to disable prompting? What's the expected behavior if clone from some repository first time with no credentials stored locally?