npm / git 失败并显示:拒绝使用缺少主机字段的凭据
npm / git fails with: refusing to work with credential missing host field
我需要像这样从 git 安装依赖项:
npm i git://hostname.com/scm/projects/project.name.git#tag123
不幸的是它失败了:
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\mingw64\bin\git.EXE ls-remote -h -t git://hostname.com/scm/projects/project.name.git
npm ERR!
npm ERR! fatal: refusing to work with credential missing host field
npm ERR!
npm ERR! exited with error code: 128
我的 .git-credentials
看起来像这样:
https://username:password@hostname.com/
和 .gitconfig
看起来像这样:
[https]
[http "https://hostname.com"]
sslCert = D:/git/ssl.crt
sslKey = D:/git/ssl.key
sslVerify = false
[url "https://hostname.com/"]
insteadOf = git://hostname.com/
[core]
longpaths = true
[credential]
helper = store
这里有什么问题,如何解决?
解决方案
完全删除 git 安装文件夹(例如:C:\Program Files\Git
)并从 https://git-scm.com/downloads.
安装最新的 git 版本
似乎 git 内部配置损坏了。
我需要像这样从 git 安装依赖项:
npm i git://hostname.com/scm/projects/project.name.git#tag123
不幸的是它失败了:
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\mingw64\bin\git.EXE ls-remote -h -t git://hostname.com/scm/projects/project.name.git
npm ERR!
npm ERR! fatal: refusing to work with credential missing host field
npm ERR!
npm ERR! exited with error code: 128
我的 .git-credentials
看起来像这样:
https://username:password@hostname.com/
和 .gitconfig
看起来像这样:
[https]
[http "https://hostname.com"]
sslCert = D:/git/ssl.crt
sslKey = D:/git/ssl.key
sslVerify = false
[url "https://hostname.com/"]
insteadOf = git://hostname.com/
[core]
longpaths = true
[credential]
helper = store
这里有什么问题,如何解决?
解决方案
完全删除 git 安装文件夹(例如:C:\Program Files\Git
)并从 https://git-scm.com/downloads.
似乎 git 内部配置损坏了。