microsoft / Git-Credential-Manager-for-Mac-and-Linux

Git Credential Manager for Mac and Linux stores credentials for Git version control securely. Provides secure logon for Visual Studio Team Services (visualstudio.com).
Other
406 stars 240 forks source link

Authentication fails on macOS Mojave #87

Open David-Noble-at-work opened 6 years ago

David-Noble-at-work commented 6 years ago

I've got the latest pre-release installed:

10.14 Beta (18A371a)

The credential manager is now popping an OAuth dialog and then failing to authenticate. Let me know if you'd like a Debug trace and I'll send one that removes personal information. Here's the relevant git config:

credential.helper = !/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/bin/java -Ddebug=true -Djava.net.useSystemProxies=true -jar /Users/david-noble/local/lib/git-credential-manager-2.0.3.jar
novak commented 6 years ago

This is likely related to issues with newer versions of Java, specifically 9+. Version 2.0.4 of Git Credential Manager was just released, it is available on Github and will be on Homebrew soon.

Let me know if you still see issues on Mojave with that new version.

novak commented 6 years ago

Feel free to re-open this issue if the bug still exists in 2.0.4

maxmilton commented 6 years ago

I'm running into the same issue. I'm absolutely sure I'm entering the correct user/pass but still get:

Fatal: java.lang.Error encountered.  Details:
/usr/bin/security exited with result 51.
stdOut:
stdErr: security: SecKeychainItemCreateFromContent (<default>): The user name or passphrase you entered is not correct.
add-generic-password: returned -25293

fatal: credential helper '!/Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre/bin/java -Ddebug=false -Djava.net.useSystemProxies=true -jar /usr/local/Cellar/git-credential-manager/2.0.4/libexec/git-credential-manager-2.0.4.jar' told us to quit

This is on:

 uname -a
Darwin XXXX-MacBook-Pro.local 17.7.0 Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64 x86_64 i386 MacBookPro14,3 Darwin
novak commented 6 years ago

@MaxMilton thanks for the additional information. Would it be possible for you to run it again with the credential manager flag -Ddebug=true?

jasonwist commented 5 years ago

Hi @novak,

I believe I'm getting a similar issue. While it still pulls correctly (I'm using Azure & a PAT) I get the same error thrown. Darwin XXXXX 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64

When running git clone it prompts for a password. I enter my PAT and this is the following I get when I run it with debug on.

`Cloning into 'XXXX'... Configuration::loadGitConfiguration Configuration::ParseGitConfig core.editor = vim core.excludesfile = /Users/XXXX/.gitignore_global credential.helper = !/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/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 filter.lfs.clean = git-lfs clean -- %f filter.lfs.process = git-lfs filter-process filter.lfs.required = true filter.lfs.smudge = git-lfs smudge -- %f user.email = XXXX user.name = XXXX Program::loadOperationArguments Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Program::EnableTraceLogging Program::get targetUri = https://dev.azure.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:https://dev.azure.com SecretStore::readCredentials SecretCache::readCredentials SecretCache::_getTargetName Secret::uriToName target name = gcm4ml:git:https://dev.azure.com BaseSecureStore::readCredentials Password for 'https://XXXX@dev.azure.com/': Configuration::loadGitConfiguration Configuration::ParseGitConfig core.editor = vim core.excludesfile = /Users/XXXX/.gitignore_global credential.helper = !/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre/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 filter.lfs.clean = git-lfs clean -- %f filter.lfs.process = git-lfs filter-process filter.lfs.required = true filter.lfs.smudge = git-lfs smudge -- %f user.email = XXXX user.name = XXXX Program::loadOperationArguments Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Configuration::tryGetEntry Program::EnableTraceLogging Program::store targetUri = https://dev.azure.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::setCredentials SecretStore::writeCredentials SecretStore::getTargetName Secret::uriToName target name = gcm4ml:git:https://dev.azure.com BaseSecureStore::writeCredential Fatal error encountered. Details: java.lang.Error: /usr/bin/security exited with result 51. stdOut: stdErr: security: SecKeychainItemCreateFromContent (): The user name or passphrase you entered is not correct. add-generic-password: returned -25293

    at com.microsoft.alm.storage.macosx.KeychainSecurityCliStore.checkResult(KeychainSecurityCliStore.java:325)
    at com.microsoft.alm.storage.macosx.KeychainSecurityCliStore.write(KeychainSecurityCliStore.java:412)
    at com.microsoft.alm.storage.macosx.KeychainSecurityCliStore.writeCredential(KeychainSecurityCliStore.java:421)
    at com.microsoft.alm.storage.macosx.KeychainSecurityBackedCredentialStore.writeCredential(KeychainSecurityBackedCredentialStore.java:9)
    at com.microsoft.alm.storage.macosx.KeychainSecurityBackedCredentialStore.add(KeychainSecurityBackedCredentialStore.java:19)
    at com.microsoft.alm.storage.macosx.KeychainSecurityBackedCredentialStore.add(KeychainSecurityBackedCredentialStore.java:9)
    at com.microsoft.alm.authentication.SecretStoreAdapter.writeCredential(SecretStoreAdapter.java:53)
    at com.microsoft.alm.authentication.BaseSecureStore.writeCredential(BaseSecureStore.java:57)
    at com.microsoft.alm.authentication.SecretStore.writeCredentials(SecretStore.java:153)
    at com.microsoft.alm.authentication.BasicAuthentication.setCredentials(BasicAuthentication.java:83)
    at com.microsoft.alm.gitcredentialmanager.Program.store(Program.java:437)
    at com.microsoft.alm.gitcredentialmanager.Program.store(Program.java:428)
    at com.microsoft.alm.gitcredentialmanager.Program.access$300(Program.java:63)
    at com.microsoft.alm.gitcredentialmanager.Program$4.call(Program.java:414)
    at com.microsoft.alm.gitcredentialmanager.Program$4.call(Program.java:411)
    at com.microsoft.alm.gitcredentialmanager.Program.innerMain(Program.java:195)
    at com.microsoft.alm.gitcredentialmanager.Program.main(Program.java:123)

remote: Azure Repos remote: Found 9 objects to send. (158 ms) Unpacking objects: 100% (9/9), done.`

Hope this helps.

nathanrobinson commented 5 years ago

git-credential-manager-2.0.4.jar would not open a browser for https://[organization]@dev.azure.com/[organization]... It kept trying to fall back to basic auth. But it did oauth and clone correctly when using the https://[organization].visualstudio.com/... url. Both urls were copied from the "Clone" https link.

jrbriggs commented 5 years ago

I'd recommend trying GCM Core's macOS preview release