安装Bower库时的问题

3

我在我的项目中使用bower来安装依赖和各种库。但是我遇到一个致命错误。URL的git://部分似乎被insteadof替换了。

我正在使用Mac OS X终端执行命令。

有没有解决办法?

pdc1-4s6zyr1:~ administrator$ bower install **git://github.com/jquery/jquery.git**
bower not-cached    git://github.com/jquery/jquery.git#*
bower resolve       git://github.com/jquery/jquery.git#*
bower ECMDERR       Failed to execute "git ls-remote --tags --heads git://github.com/jquery/jquery.git", exit code of #128

Additional error details:
fatal: '.insteadofgithub.com/jquery/jquery.git' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

感谢您,Ankit Tanna。

你能发一下你的bower.json文件吗? - ianaya89
2个回答

3

打开终端并输入以下内容:

git config --global url."https://".insteadOf git://

这将强制git替换协议。

此外,如果您在bower.json中包含github仓库,可以尝试将文件中的git URL的'git://'替换为'https://'。


它没有起作用。它仍然显示相同的错误。您知道如何完全删除git配置吗? - Ankit Tanna
@AnkitTanna 你可以查找配置文件:~/.gitconfig 并删除所有设置。你的 bower 文件可能有问题吗? - ianaya89
1
嗨,问题是其中一个URL的值为空。只需添加https [url“https://”] - Ankit Tanna

2
解决问题的方法是:
找到 .gitconfig 文件。
 [user]
        name = 1wQasdTeedFrsweXcs234saS56Scxs5423
        email = ankittanna@hotmail.com
    [credential]
        helper = osxkeychain
    [url ""]
        insteadOf = git://
    [url "https://"]
    [url "https://"]
        insteadOf = git://

将空的url=""替换为url="https://"

[user]
    name = 1wQasdTeedFrsweXcs234saS56Scxs5423
    email = ankittanna@hotmail.com
[credential]
    helper = osxkeychain
[url "https://"]
    insteadOf = git://
[url "https://"]
[url "https://"]
    insteadOf = git://

这会起作用:)
开心地使用Bower。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接