首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >npm / git失败:拒绝使用凭据丢失的主机字段

npm / git失败:拒绝使用凭据丢失的主机字段
EN

Stack Overflow用户
提问于 2021-10-12 09:51:33
回答 1查看 2.4K关注 0票数 1

我需要像这样从git中安装一个依赖项:

npm i git://hostname.com/scm/projects/project.name.git#tag123

不幸的是,它失败了:

代码语言:javascript
运行
复制
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看起来是这样的:

代码语言:javascript
运行
复制
https://username:password@hostname.com/

.gitconfig看起来是这样的:

代码语言:javascript
运行
复制
[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

这里有什么问题,怎么解决?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-01-19 15:49:55

解决方案

完全删除git安装文件夹(例如:C:\Program Files\Git),并从https://git-scm.com/downloads中安装最新的git版本。

就像一个配置变坏了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69538431

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档