Bower只使用https安装?

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

有没有一个开关或首选项,将指示凉亭执行git克隆使用https而不是git协议?

我查看了源代码,并考虑更改parsing代码,以https://replacegit:// https:// ,但我想我会问到在这些长度之前。

你可以让gitreplace你的协议。 赶紧跑:

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

基于@Sindre的回答,我在BASH中写了一个辅助函数,它存在于我的~/.bashrc文件中。 就像你会grunt Call地叫,除了现在叫做nngrunt 。 请享用!

 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 }