Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java error when using git-credential-manager in Mac on OSX?

Tags:

git

macos

I have installed and configured git-credential-manager on Mac OSX according to these instructions:

https://github.com/Microsoft/Git-Credential-Manager-for-Mac-and-Linux/blob/master/Install.md

The brew install complained about a missing Java requirement and suggested a command to install Java, which I did.

After completing everything, I now get the following error when trying to perform a git clone from a private repository:

Cloning into 'Weather'...
Fatal: java.lang.IllegalArgumentException encountered.  Details:
Unrecognized version string '9+181'.
fatal: credential helper '!/Library/Java/JavaVirtualMachines/jdk-
9.jdk/Contents/Home/bin/java -Ddebug=false -Djava.net.useSystemProxies=true 
-jar /usr/local/Cellar/git-credential-manager/2.0.3/libexec/git-credential-
manager-2.0.3.jar' told us to quit

Does anyone know how to fix?

like image 527
OlavT Avatar asked Oct 16 '17 12:10

OlavT


People also ask

How do I manage Git credentials on Mac?

You can tell Git to remember your credentials by using a credential helper, so that you don't have to enter your username and password every time you clone a GitHub repository. On Mac, you can use osxkeychain helper . This tells Git to use the osxkeychain credentials helper .

How do I reset my Git credential helper?

You could also disable use of the Git credential cache using git config --global --unset credential. helper . Then reset this, and you would continue to have the cached credentials available for other repositories (if any). You may also need to do git config --system --unset credential.

What is the new Git Credential Manager for Mac and Linux?

Today we are announcing the open-source release of the Git Credential Manager (GCM) for Mac and Linux . This follows the release of the GCM for Windows . We ported this tool to Mac and Linux to simplify their authentication to remote Git repositories, in particular those hosted in Visual Studio Team Services (VSTS).

How do I use osxkeychain credentials in Git?

git config --global credential.helper osxkeychain This tells Git to use the osxkeychain credentials helper. Once you have authenticated successfully, your credentials will be stored in the MacOS keychain and will be used every time you clone your GitHub repository.

How do I cache GitHub credentials on Mac?

Caching your GitHub credentials in Git You can tell Git to remember your credentials by using a credential helper, so that you don’t have to enter your username and password every time you clone a GitHub repository. On Mac, you can use osxkeychain helper. Use the following command on your terminal:

What is gitcredentialmanager (GCM)?

Merge pull request #800 from GitCredentialManager/dependabot/nuget/sr… Git Credential Manager (GCM) is a secure Git credential helper built on .NET that runs on Windows, macOS, and Linux.


2 Answers

Oct. 2017: That is tracked with Microsoft/Git-Credential-Manager-for-Mac-and-Linux issues/69

I dumped Java 9 and installed Java 8, and everything worked just fine.

brew cask remove java    

Reinstall git-credential-manager

git-credential-manager install

I stumbled on the same issue as @JoeyHerrington and installed JDK8 instead:

brew cask install caskroom/versions/java8

Update Sept. 2018: the same issue now includes:

version 2.0.4 of Git Credential Manager now supports Java 9+.
The update is available on GitHub and will be available on Homebrew soon.

So the OP (one year later) should not be an problem anymore.


Thomas Hagström adds in the comments:

I would say removing the folders is safest.

sudo rm -rf "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin" 
sudo rm -rf "/Library/PreferencePanes/JavaControlPanel.prefPane" 
sudo rm -rf "~/Library/Application Support/Oracle" 
sudo rm -rf "~/Library/Java"

Then reinstall git credential manager so it picks up the correct Java version / virtual machine.

like image 101
VonC Avatar answered Oct 13 '22 15:10

VonC


I had the same issue after I inserted some wrong credentials requested by git while using IntelliJ. I solved it by changing the helper in ~/.gitconfig, (like @Migg said :). My gitconfig was pointed to the Java 8, and how I had already installed Java 8 and Java 11 installed in my machine (OSX 10.14). I just pointed to the newest version.

Before

[user]
    email = <email>
    name = <name>
[core]
    autocrlf = input
[credential]
    helper = !/Library/Java/JavaVirtualMachines/<java-1.8>/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

After

credential]
        helper = !/Library/Java/JavaVirtualMachines/jdk-11.0.3.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
like image 3
Victor Henrique Avatar answered Oct 13 '22 13:10

Victor Henrique