繁体   English   中英

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

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

我有一台运行 Ubuntu 18.04.3 LTS 的服务器。 我想保存我的 git 凭据,所以我不必每次都输入它们。 我运行以下命令:

git config --global credential.helper store

然后我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':

之后,我被要求输入我的用户名和密码。 然后打印相同的错误。

我已经多次重复相同的过程,取消设置credential.helper选项:

git config --global --unset credential.helper

我执行了这个命令

git config --global --unset credential.helper

而此时我在 git pull 命令之后已经没有错误了。 我有版本 2.34.1.windows.1 的 git

文档显示了命令

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

因此, git似乎很可能只是执行credential.helper中设置的命令。 设置的命令只是store ... 它需要一个强制参数 ... 您没有提供。

这解释了为什么store命令(实际上是git credential-store )没有按预期工作。

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

您使用的 credential-manager 命令可能已被弃用或适用于不同的操作系统。 在关注有关保存 GitHub 凭据的博客后,我遇到了这个问题,然后意识到它们是针对 Windows 而不是 Linux。 也可能是我没有像 Useless 在他/她的回答中所说的那样传递适当的论据。

无论哪种方式,我通过进入 ~/.gitconfig 并删除最后关于凭证管理器的行来解决它。 尝试此操作需要您自担风险。 不知道会不会有什么不可预见的后果。

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

git config --remove-section credential

暂无
暂无

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

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