首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Bower安装只使用https?

Bower安装只使用https?
EN

Stack Overflow用户
提问于 2013-03-28 04:46:05
回答 3查看 70.2K关注 0票数 256

我正试图在我们组织的数据中心的构建服务器上设置Bower,但是git的端口在数据中心的防火墙上似乎没有打开,我可以使用git命令行客户端通过https://[repo]进行克隆,但不能通过git://[repo]

是否有一个开关或首选项指示bower使用https而不是git协议执行git克隆?

我已经查看了源代码,并考虑用https://替换git://的分辨率代码,但我认为在讨论这些内容之前,我应该先问一下。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-03-28 22:48:27

您可以让git替您替换协议。只需运行:

代码语言:javascript
复制
git config --global url."https://".insteadOf git://

使用HTTPS协议而不是Git。

票数 627
EN

Stack Overflow用户

发布于 2015-12-11 06:52:37

基于@Sindre的回答,我用BASH编写了一个小的helper函数,它位于我的~/.bashrc文件中。除了现在它被称为nngrunt之外,就像你将它称为grunt一样。享受吧!

代码语言:javascript
复制
function nngrunt
{
    # Add a section to the global gitconfig file ~/.gitconfig that tells git to
    # go over http instead of the git protocol, otherwise bower has fits...
    # See http://stackoverflow.com/questions/15669091/bower-install-using-only-https
    git config --global url."https://".insteadOf git://

    # Run grunt w/ any supplied args
    grunt "$@"

    # Now cleanup the section we added to the git config file
    # Of course we have our own extra cleanup to do via sed since the unset command
    # leaves the section around
    # See http://git.661346.n2.nabble.com/git-config-unset-does-not-remove-section-td7569639.html
    git config --global --unset url."https://".insteadOf
    sed -i 's/\[url "https:\/\/"\]//' ~/.gitconfig
    sed -i '/^$/d' ~/.gitconfig
}
票数 2
EN

Stack Overflow用户

发布于 2018-08-05 12:39:38

为我工作git config --global url."git://".insteadOf https://

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

https://stackoverflow.com/questions/15669091

复制
相关文章

相似问题

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