【发布时间】:2018-10-21 17:03:02
【问题描述】:
我正在尝试在 Linux Raspbian 8.0 上运行 npm install git+https://bitbucket.org/User/Repository。但是,我收到此错误:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://bitbucket.org/User/Repository.git
npm ERR!
npm ERR! remote: Invalid username or password
npm ERR! fatal: Authentication failed for 'https://bitbucket.org/User/Repository.git/'
npm ERR!
npm ERR! exited with error code: 128
我的 Bitbucket 用户名和应用密码应该在全局和目录 git 配置中都可用:
git config user.name "Username"
git config user.password "Password"
git config --global user.name "Username"
git config --global user.password "Password"
所以,npm 应该可以使用正确的用户名和密码,但它似乎没有使用它们。
另外,为免生疑问,我已通过将用户名和密码直接与git 一起使用来验证用户名和密码是否正确。
任何帮助解决此问题将不胜感激!
编辑 感谢 cmets 中的 Matthieu Moy 指出我使用的配置值实际上对 Git 没有任何特殊含义。
According to documentation,用户名和密码组合可以存储在~/.git-credentials中。我已经这样做了,格式为https://Username:Password@bitbucket.org。但是,与上述相同的错误仍然存在。我已验证用户名和应用程序密码是否正确。 Git 似乎根本没有使用它们。
【问题讨论】:
-
user.name是您的全名(如 John Smith),在您提交时使用。这不是远程站点上使用的登录名。我不知道您的user.password来自哪里,但它不是记录在案的 Git 配置变量。 -
感谢您指出这一点!我一直发现 git 文档相当混乱,而且我一定在途中迷路了。我会再次查看
git-credential-store。