git: 'credential-manager' is not a git command

Viewed 17745

I have a server running Ubuntu 18.04.3 LTS. I want to save my git credentials, so I don't have to enter them every time. I run the following command:

git config --global credential.helper store

Then I git pull and get:

user@host:~/project$ git pull
git: 'credential-manager' is not a git command. See 'git --help'.
usage: git credential-store [<options>] <action>

    --file <path>         fetch and store credentials in <path>

Username for 'https://gitlab.com':

After that I'm being asked for my username and password. And then the same error is printed.

I've already repeated the same process several times, unsetting the credential.helper option with:

git config --global --unset credential.helper
4 Answers

I executed this command

git config --global --unset credential.helper

and at this time I already got no error after git pull command. I have git of version 2.34.1.windows.1

The documentation shows the command

$ git config --global credential.helper 'store --file ~/.my-credentials'

So it seems likely that git simply executes the command set in credential.helper. The command you set is just store ... which requires a mandatory argument ... which you haven't provided.

This explains why the store command (actually git credential-store) isn't working as you expect.

I don't know where the complaint about credential-manager comes from - most likely it's just mis-reporting all failure states as "not a git command".

It may be that the credential-manager command you are using is either deprecated or is for a different OS. I ran into this problem after following a blog about saving the GitHub credentials and then realized that they were for Windows instead of Linux. It could also be that I didn't pass the appropriate arguments as Useless stated in his/her answer.

Either way, I solved it by going into ~/.gitconfig and removing the line at the end about the credential manager. Attempt this at your own risk though. I don't know if there are unforeseen consequences.

This answer helped me resolve the problem with the command below:

git config --remove-section credential
Related