我正试图在我们组织的数据中心的构建服务器上设置Bower,但是git
的端口在数据中心的防火墙上似乎没有打开,我可以使用git命令行客户端通过https://[repo]
进行克隆,但不能通过git://[repo]
。
是否有一个开关或首选项指示bower使用https
而不是git
协议执行git克隆?
我已经查看了源代码,并考虑用https://
替换git://
的分辨率代码,但我认为在讨论这些内容之前,我应该先问一下。
发布于 2013-03-28 22:48:27
您可以让git替您替换协议。只需运行:
git config --global url."https://".insteadOf git://
使用HTTPS协议而不是Git。
发布于 2015-12-11 06:52:37
基于@Sindre的回答,我用BASH编写了一个小的helper函数,它位于我的~/.bashrc
文件中。除了现在它被称为nngrunt
之外,就像你将它称为grunt
一样。享受吧!
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
}
发布于 2018-08-05 12:39:38
为我工作git config --global url."git://".insteadOf https://
https://stackoverflow.com/questions/15669091
复制相似问题