Answers:
您可以使git为您替换协议。赶紧跑:
git config --global url."https://".insteadOf git://
使用HTTPS协议而不是Git。
git config --global --unset url."https://".insteadOf
--global
,它将配置添加到本地.git/config
。
基于@Sindre的答案,我在BASH中编写了一个小助手函数,该函数位于我的~/.bashrc
文件中。像grunt
现在一样调用它,但现在叫做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
}
为我工作
git config --global url."git://".insteadOf https://