简体   繁体   English

git:'credential-manager' 不是 git 命令

[英]git: 'credential-manager' is not a git command

I have a server running Ubuntu 18.04.3 LTS.我有一台运行 Ubuntu 18.04.3 LTS 的服务器。 I want to save my git credentials, so I don't have to enter them every time.我想保存我的 git 凭据,所以我不必每次都输入它们。 I run the following command:我运行以下命令:

git config --global credential.helper store

Then I git pull and get:然后我git pull并得到:

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:我已经多次重复相同的过程,取消设置credential.helper选项:

git config --global --unset credential.helper

I executed this command我执行了这个命令

git config --global --unset credential.helper

and at this time I already got no error after git pull command.而此时我在 git pull 命令之后已经没有错误了。 I have git of version 2.34.1.windows.1我有版本 2.34.1.windows.1 的 git

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 .因此, git似乎很可能只是执行credential.helper中设置的命令。 The command you set is just store ... which requires a mandatory argument ... which you haven't provided.设置的命令只是store ... 它需要一个强制参数 ... 您没有提供。

This explains why the store command (actually git credential-store ) isn't working as you expect.这解释了为什么store命令(实际上是git credential-store )没有按预期工作。

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".我不知道有关credential-manager的投诉来自哪里——很可能只是将所有故障状态误报告为“不是 git 命令”。

It may be that the credential-manager command you are using is either deprecated or is for a different OS.您使用的 credential-manager 命令可能已被弃用或适用于不同的操作系统。 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.在关注有关保存 GitHub 凭据的博客后,我遇到了这个问题,然后意识到它们是针对 Windows 而不是 Linux。 It could also be that I didn't pass the appropriate arguments as Useless stated in his/her answer.也可能是我没有像 Useless 在他/她的回答中所说的那样传递适当的论据。

Either way, I solved it by going into ~/.gitconfig and removing the line at the end about the credential manager.无论哪种方式,我通过进入 ~/.gitconfig 并删除最后关于凭证管理器的行来解决它。 Attempt this at your own risk though.尝试此操作需要您自担风险。 I don't know if there are unforeseen consequences.不知道会不会有什么不可预见的后果。

这个答案帮助我解决了以下命令的问题:

git config --remove-section credential

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM